-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
28 lines (25 loc) · 1.18 KB
/
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
var locomotive = require('locomotive')
, bootable = require('bootable');
// Create a new application and initialize it with *required* support for
// controllers and views. Move (or remove) these lines at your own peril.
var app = new locomotive.Application();
app.phase(locomotive.boot.controllers(__dirname + '/app/controllers'));
app.phase(locomotive.boot.views());
// Add phases to configure environments, run initializers, draw routes, and
// start an HTTP server. Additional phases can be inserted as needed, which
// is particularly useful if your application handles upgrades from HTTP to
// other protocols such as WebSocket.
app.phase(require('bootable-environment')(__dirname + '/config/environments'));
app.phase(bootable.initializers(__dirname + '/config/initializers'));
app.phase(locomotive.boot.routes(__dirname + '/config/routes'));
app.phase(locomotive.boot.httpServer(3000, '0.0.0.0'));
// Boot the application. The phases registered above will be executed
// sequentially, resulting in a fully initialized server that is listening
// for requests.
app.boot(function(err) {
if (err) {
console.error(err.message);
console.error(err.stack);
return process.exit(-1);
}
});