Skip to content

Instantly share code, notes, and snippets.

@willikay11
Created July 29, 2020 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willikay11/11367364bae61217a032b39d10bd9b9b to your computer and use it in GitHub Desktop.
Save willikay11/11367364bae61217a032b39d10bd9b9b to your computer and use it in GitHub Desktop.
import { Sequelize } from 'sequelize';
import { config } from '../config/local';
export const sequelize = new Sequelize(config.database, config.username, config.password, {
host: config.host,
dialect: 'mysql'
});
export const connect = async () => {
try {
await sequelize.authenticate();
console.log('Connected to database');
} catch (e) {
console.log('Failed to connect to database', e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment