Skip to main content

connect()

This function is used to connect simply-xp to a database, and configure client options.

Parameters​

ParameterTypeRequiredDescription
uristringβœ…The URI to connect to the database.
optionsConnectionOptions❌The options to configure the client.

Returns​

  • Promise<boolean> - If the connection was successful.

Throws​

  • XpFatal - If the connection was unsuccessful, or if the URI is invalid.

[JS] Example​

const {connect} = require('simply-xp');

connect('path/to/file.sqlite') // Returns Promise<boolean>
.then(console.log) // Returns true if connection was successful
.catch((err) => console.log(err)); // Returns the error