-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
49 lines (41 loc) · 866 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
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* server.js: Simple http server with `commandful` router
*
* (C) 2012, Nodejitsu Inc.
*
*/
var fixtures = require('../test/fixtures'),
commandful = require('../lib/commandful'),
flatiron = require('flatiron');
//
// Create a new flatiron app
//
var app = new flatiron.App;
//
// Use the flatiron cli plugin
//
app.use(flatiron.plugins.cli);
//
// Use the resourceful plugin and attach some resources
//
app.use(flatiron.plugins.resourceful);
app.resources = {
Creature: fixtures.Creature,
Album: fixtures.Album,
Song: fixtures.Song
};
//
// Extend the app's router with commandful
//
app.use(commandful);
//
// We can also set custom routes, since it's just a `Director.Router` instance
//
app.router.on('foo', function(){
app.log.info('a custom foo route.');
})
app.start(function (err) {
if (err) {
throw err;
}
});