forked from buddman1208/EDRANET_Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
executable file
·45 lines (40 loc) · 1.23 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
var port = 8000;
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
// routes
var routes = require('./routes');
var index = require('./routes/index');
var admin = require('./routes/admin');
var auth = require('./routes/auth');
var notice = require('./routes/notice');
var attendence = require('./routes/attendance');
var app = express();
var http = require('http').Server(app);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// app.use(cookieParser());
// app.use(session({
// secret: '314159265358979323846264338',
// resave: false,
// saveUninitialized: true
// }));
app.use('/admin', admin);
app.use('/auth', auth);
app.use('/notice', notice);
app.use('/attendence', attendence);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(function(req, res, next) {
var err = new Error('404 Not Found');
err.status = 404;
next(err);
});
module.exports = app;
http.listen(port, function(){
console.log('EDRANET Backend running on Port ' + port);
});