-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
28 lines (23 loc) · 639 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const express = require('express');
const bodyParser = require('body-parser');
const adminRoutes = require('./routes/admin');
const authRoutes = require('./routes/auth');
require('dotenv').config();
const port = process.env.PORT || 5000;
const sequelize = require('./util/database');
const cors = require('cors');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(cors());
app.use(adminRoutes);
app.use(authRoutes);
sequelize
.sync()
.then(result => {
console.log('Connected');
})
.catch(err => {
console.log(err);
});
app.listen(port);