-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
50 lines (33 loc) · 1.28 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
46
47
48
49
50
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var session = require('express-session');
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json({ limit: '50mb' }));
app.use(session({
secret: 'programmers always pay their depts',
resave: false,
saveUninitialized: true
}));
app.use(function(req, res, next) { //allow cross origin requests
res.setHeader("Access-Control-Allow-Methods", "POST, PUT, OPTIONS, DELETE, GET");
res.header("Access-Control-Allow-Origin", "http://localhost");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use(express.static(__dirname + '/public'));
app.use('/libraries', express.static(__dirname + '/libraries'));
app.use(bodyParser.json());
// start server on the specified port and binding host
app.listen(8080, '0.0.0.0', function() {
// print a message when the server starts listening
console.log("server starting on port" + 8080);
});
// app.use(function(req, res) {
// res.sendfile('./admin/index.html');
// });
// Send all unhandled routing request to angular app
// app.all('/*', function (req, res) {
// res.sendfile('./admin/index.html');
// });