rest-helper

0.1.0 • Public • Published

rest-helper

  • Use JSON text file to simulate REST data source

install

npm install rest-helper

usage

var express = require('express');
var RESTHelper = require('rest-helper');
var items = new RESTHelper('items'); // items folder contains individual json files
var app = express();

app.get('/items', function (req, res) {
    items.findAll(req, res);
});
app.get('/items/:id', function (req, res) {
    items.findById(req, res);
});
app.post('/items', function (req, res) {
    items.add(req, res);
});
app.put('/items/:id', function (req, res) {
    items.updateById(req, res);
});
app.delete('/picklist.svc/view', function (req, res) {
    items.removeAll(req, res);
});
app.delete('/picklist.svc/view/:id', function (req, res) {
    items.removeById(req, res);
});

Readme

Keywords

none

Package Sidebar

Install

npm i rest-helper

Weekly Downloads

0

Version

0.1.0

License

none

Last publish

Collaborators

  • donlee