-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
53 lines (38 loc) · 853 Bytes
/
server.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
47
48
49
50
51
52
53
// Dependencies
// ============
var express = require('express');
var http = require('http');
var path = require('path');
// Express
// =======
var app = express();
// Config
// ======
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
// Middleware
// ==========
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
// Routes
// ======
// GET: /
app.get('/', function (req, res) {
res.render('index');
});
// Sub apps
// ========
// Admin
var admin = require('./apps/admin/app.js');
app.use('/admin', admin);
// API
var api = require('./apps/api/app.js');
app.use('/api', api);
// Server
// ======
http.createServer(app).listen(1337, function(){
console.log('Express server listening on port ' + 1337);
});