rest-rap

0.0.3 • Public • Published

rest-rap

BuildStatus

A simple express middleware for automatic in-memory rest routes.

Usage

It will automatically respond to all requests to /api/modelName with an in-memory cache.

Request examples

GET    /api/posts
  received:
  {
    "posts": [
      { id: 0, name: "Test"},
      { id: 1, name: "Test"}
    ]
  }
GET    /api/posts/1
  received:
  {
    "post": {
      id: 0,
      name: "Test"
    }
  }
GET    /api/posts?ids[]=1&ids[]=2
  received:
  {
    "posts": [
      { id: 1, name: "Test"},
      { id: 2, name: "Test"}
    ]
  }

POST   /api/posts
  sent:
  {
    id: 0,
    name: "Test"
  }

  received:
  {
    "post": {
      id: 0,
      name: "Test"
    }
  }

PUT    /api/posts/1
  sent:
  {
    id: 0,
    name: "Test"
  }

  received:
  {
    "post": {
      id: 0,
      name: "Test"
    }
  }

DELETE /api/posts/1
  sent: null
  received: null

Ember CLI

npm install --save-dev rest-rap

That's it! Your API is now available at /api

Express App

npm install --save-dev rest-rap

then

var restRap = require('rest-rap');
 
var app = express();
 
app.use(restRap())

Package Sidebar

Install

npm i rest-rap

Weekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • matthewhager
  • evancorl
  • kmills006
  • chuongle
  • jakecraige