Database Class extends sequelize.Sequelize

This is the class that makes the database connection.
See here for other available methods.

Instance Methods

Name Description
public constructor() Instantiate sequelize with name of database, username and password.
public isConnect() Test the connection by trying to authenticate. It runs SELECT 1+1 AS result query.
Return:
  • Promise<boolean> Returns true if it can connect to the database, false if it cannot.
import * as sweet from 'express-sweet';
  
const isConnected = await sweet.database.Database.isConnect();
const database = require('express-sweet').database.Database;
  
const isConnected = await database.isConnect();