-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (24 loc) · 827 Bytes
/
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
var express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const morgan = require('morgan');
const config = require('config');
const http = require('http');
var app = express();
app.use(cors());
var nservices = require('./lib/norma_services.js');
var routerAPI = require('./routes/api.js');
const fileStorageCM = config.fileStorageCM;
// configure the app
// log requests to the console
app.use(morgan('dev'));
// configure body parser
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// set our port
var port = process.env.PORT || config.defaultPort;
// Register our routes
app.use('/api', routerAPI);
var server = http.createServer(app);
app.server = server;
module.exports = { app: app, server: server };