Last active
July 29, 2020 12:07
-
-
Save willikay11/7fd6bebc385fb5b28d1ad3c8e38e215c to your computer and use it in GitHub Desktop.
call connect sequelize orm to db method when the server starts
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 express from 'express'; | |
import { json, urlencoded } from 'body-parser'; | |
import { connect } from './utils/database'; | |
export const app = express(); | |
app.use(json()); | |
app.use(urlencoded({ extended: true })); | |
export const start = async () => { | |
try { | |
await connect(); | |
app.listen(4000, () => { | |
console.log('Server is listening on http://localhost:4000') | |
}) | |
} catch (e) { | |
console.log(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment