forked from 2ledger/samples-client-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
46 lines (36 loc) · 1.5 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
'use strict';
var express = require('express'),
contentType = require('content-type'),
concat = require('concat-stream'),
load = require('express-load'),
app = express(),
getRawBody = require('raw-body'),
bodyParser = require('body-parser'),
methodOverride = require('method-override'),
cookieParser = require('cookie-parser'),
cfg = require('./config').Config,
http = require("http");
var path = require('path');
global.pathRootApp = path.resolve(__dirname);
app.use(methodOverride());
app.use(bodyParser.json({limit:1024102420, type:'application/json'}));
app.use(bodyParser.text());
global.env = cfg.env;
global.cfg = cfg;
load('models')
.then('controllers')
.then('models')
.then('routes')
.into(app);
var serveIndex = require('serve-index');
app.use(cookieParser());
app.use('/', express.static(__dirname + '/public/', { 'index': 'index.html' }));
app.listen(cfg.port, cfg.host, function () {
console.info("########################################################################");
console.info("## POWER SERVER STARTED POWER ##");
console.info("########################################################################");
console.info('Enviroment: ', cfg.env);
console.info('URL: ', cfg.host + ":" + cfg.port);
console.info("------------------------------------------------------------------------");
});
console.info("------------------------------------------------------------------------");