appresource
v0.1.1
Published
Rails, Laravel -like resource routes for express
Downloads
5
Readme
appresource
Rails, Laravel -like resource routes for express
Install
$ npm install appresource
Usage
var app = express();
var appresource = require('appresource')(app);
var UserController = require('./controller/UserController');
app.get('/hello', function(req, res) {});
appresource('/users', UserController);
Or use on express.Router
var router = express.Router();
var routerresource = require('appresource')(app);
var UserController = require('./controller/UserController');
router.get('/hello', function(req, res) {});
routerresource('/users', UserController);
UserController.js:
module.exports = {
index: function(req, res) {},
create: function(req, res) {},
store: function(req, res) {},
show: function(req, res) {},
edit: function(req, res) {},
update: function(req, res) {},
destroy: function(req, res) {}
}
License
MIT © C. T. Lin