-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
43 lines (29 loc) · 913 Bytes
/
server.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
35
36
37
38
39
40
41
42
43
var express = require('express'),
session = require('express-session'),
bodyParser = require('body-parser');
var app = express(),
PORT = process.env.PORT || 8080;
// Static directory
app.use(express.static("./app/public"));
//For BodyParser
app.use(bodyParser({ defer: true }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//Models
var db = require("./app/models");
// Routing
var appointment = require("./app/controllers/authcontroller");
app.use("/", appointment);
var server;
//Sync Database
db.sequelize.sync({ }).then(function() {
console.log('Nice! Database looks fine');
server = app.listen(PORT, function(err) {
if (!err)
console.log("Site is live");
else console.log(err)
});
}).catch(function(err) {
console.log(err, "Something went wrong with the Database Update!");
});
module.exports = server;