appresource

0.1.1 • Public • Published

appresource Build Status

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

Dependents (0)

Package Sidebar

Install

npm i appresource

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • chentsulin