Skip to content
This repository has been archived by the owner on Jan 21, 2019. It is now read-only.

stackkit/stackkit-resource-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

stackkit-resource-router

A resource router for express. This package will automatically create all the routes for a restful application.

Installation

Using npm

npm install stackkit-resource-router

In nodejs

const express = require('express')
const app = express()

const router = require('stackkit-resource-router')

router.use(app)
router.resource('/test', require('./testController'))

app.listen(3000)

Example controller

exports.index = function(req, res){
  res.send('test index');
};

exports.store = function(req, res){
  res.send('test server');
};

exports.show = function(req, res){
  res.send('show test ' + req.params.id);
};

exports.update = function(req, res){
  res.send('update test ' + req.params.id);
};

exports.destroy = function(req, res){
  res.send('destroy test ' + req.params.id);
};

Releases

No releases published

Sponsor this project

 

Packages

No packages published