-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (27 loc) · 812 Bytes
/
Copy pathserver.js
File metadata and controls
30 lines (27 loc) · 812 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
var connection = require('./dbconnection');
var restify = require('restify');
var bodyParser = require('body-parser');
var server = restify.createServer({
name: 'Nodeapp',
version: '1.0.0'
});
server.pre(restify.pre.sanitizePath());
server.use(restify.plugins.acceptParser(server.acceptable));
server.use(restify.plugins.queryParser());
server.use(restify.plugins.bodyParser({
requestBodyOnGet: true
}));
server.use(bodyParser.json({limit: '50mb'}));
server.use(bodyParser.urlencoded({
limit: '25mb',
extended: true
}));
var routes = require('./api/routes/Routes');
routes(server);
var app=server.listen(80, function () {
console.log('%s listening at %s', server.name, server.url)
});
server.get(/\/?.*/, restify.plugins.serveStatic({
directory: './',
default: 'index.html'
}))