-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
38 lines (33 loc) · 1.12 KB
/
server.js
File metadata and controls
38 lines (33 loc) · 1.12 KB
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
var express = require("express"),
load = require("express-load"),
app = express(),
bodyParser = require("body-parser"),
server = require('http').createServer(app),
appPath = 'core/';
/*
* PATH FOR HTML FILES
*/
app.use(express.static("public"));
app.use(bodyParser.urlencoded({
extended: false
}));
app.use(bodyParser.json());
app.use('/',express.static('public/html'));
app.use('/app',express.static('public/app'));
app.use('/assets',express.static('public'));
/*
* AUTO LOAD MODELS , CONTROLLERS AND ROUTES INDO APPLICATION INSTANCE
* AUTO LOAD CONFIG SERVER
*/
load('core/config').then('core/helpers').then('core/lib').then('core/models').into(app);
load('core/controllers').then('core/routes.js').into(app);
for (var environment in app.core.config) {
if (environment == app.get('env')) {
for (var key in app.core.config[environment]) {
app.set(key, app.core.config[environment][key]);
}
}
}
server.listen(app.get('port'), function() {
console.log('%s está em %s mode na porta %s', app.get('title'), app.get('env'), app.get('port'));
});