-
Notifications
You must be signed in to change notification settings - Fork 2
Quickstart
jarnoux edited this page Jun 24, 2013
·
5 revisions
- Create your entry point file: server.js
var Rig = require('rig'),
rig = new Rig({
config: 'config.json',
routes: 'routes.json'
});
rig.register('middleware.myMiddleware', function (config) {
return function (req, res, next) {
res.end(config.message);
};
});
rig.route();
rig.listen(3000);
console.log('app listening on port', 3000);
- Create your configuration file: config.json
{
"middleware": {
"myMiddleware": {
"message": "Hello World!\n"
}
}
}
- Create your routes file: routes.json
{
"": ["middleware.myMiddleware"]
}
- Install Rig and start your app
$ npm install rig
$ node ./server.js
- Done! Try
localhost:3000
in your browser now :)