Skip to content

Instantly share code, notes, and snippets.

@willikay11
Last active July 29, 2020 12:07
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/7fd6bebc385fb5b28d1ad3c8e38e215c to your computer and use it in GitHub Desktop.
Save willikay11/7fd6bebc385fb5b28d1ad3c8e38e215c to your computer and use it in GitHub Desktop.
call connect sequelize orm to db method when the server starts
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