Created
July 29, 2020 12:00
-
-
Save willikay11/11367364bae61217a032b39d10bd9b9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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