forked from Samanyu13/Classroom-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
executable file
·34 lines (27 loc) · 829 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
29
30
31
32
33
34
var sequelize = require('sequelize');
var models = require('./models/');
var express = require('express');
var app = express();
var routes = require('./routes/index');
var path = require('path');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
// app.set('views', path.join(__dirname, 'views'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
// app.set('view engine','ejs');
app.use('/', routes);
var port = 3000;
app.set('port', port);
var db = require('./models');
db.sequelize.sync().then(function(){
console.log('db synced');
app.listen(port, function() {
console.log('Express server listening on port ' );
});
})
.catch((err) =>{
console.log(err);
})