-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
39 lines (26 loc) · 978 Bytes
/
app.js
File metadata and controls
39 lines (26 loc) · 978 Bytes
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
GLOBAL.approot = __dirname;
var path = require('path');
GLOBAL.parentRoot = path.join(__dirname, '../'); //for code
var express = require("express"),
bodyParser = require("body-parser"),
config = require('./config/config.js'),
db = require("./database/db"),
routes = require('./routes'),
app = express();
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json({limit: '5mb'}));
app.use(bodyParser.urlencoded({limit: '5mb'}));
app.use(express.static(__dirname + '/public'));
app.all('/*', function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.post('/searchFromGoogle', routes.searchFromGoogle);
app.post('/getList', routes.getList);
var port = config.port;
var server = app.listen(port, function () {
console.log('Listening on port %d', server.address().port);
});