-
Notifications
You must be signed in to change notification settings - Fork 18
/
server.js
74 lines (60 loc) · 1.99 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var app = require('./express');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var passport = require('passport');
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.use(cookieParser());
app.use(session({ secret: "put some text here" }));
app.use(passport.initialize());
app.use(passport.session());
// require('./lectures/graduate/session/app');
app.get('/api/undergraduate/session', function (req, res) {
console.log(req.session);
res.send(req.session);
});
app.get('/api/undergraduate/session/:name/:value', function (req, res) {
var name = req.params.name;
var value = req.params.value;
var obj = {
name: value
};
req.session[name] = obj;
console.log(req.session);
res.send(req.session);
});
app.set('view engine', 'ejs');
require('./utilities/filelist');
app.use(app.express.static(__dirname + '/public'));
var blog = require('./lectures/graduate/blog/app');
blog(app);
// var todo = require('./lectures/undergraduate/todo/app');
// todo(app);
require('./assignment/undergrad/app');
// require('./assignment/graduates/app');
// require('./experiments/oxford/oxford.service.server');
// require('./lectures/undergraduate/ejs/hello');
// require('./experiments/ejs/crud');
// require('./lectures/undergraduate/ejs/crud');
// require('./lectures/graduate/ejs/crud');
// require('./lectures/graduate/mongojs');
// var movieApp = require('./movies.json');
// require('./lectures/undergraduate/wam')(movieApp);
var application = {
"name": "charterApp",
"entities": {
"boat": {
"fields": {
"brand": {},
"length": {},
"type": {}
}
},
"crew": {},
"booking": {},
"user": {}
}
};
require('./lectures/graduate/wam')(application);
app.listen(process.env.PORT || 3000);