Skip to content
No description or website provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.DS_Store
README.md
index.js
package.json

README.md

EXPRESS-ROUTES-MAP

Module avaiable on npm registry. Simple module that simplifies the creation of REST APIs on Express. The module is designed to help building rest apis, that expose CRUD functionalities on collections of datas.

Exaple

GET /collection ---> retrieve collection of resources
GET /collection/:id ---> retrieve resource with id, from collection

the same philosophy for POST (create) , PUT (update), DELETE (delete)

GETTING STARTED

server.js

var expressmap = require('express-routes-map'),
http = require('http'),
var app = express(),
.....
....
expressmap(app)
  .defineRoutes('/collectionA', require('./routes/collectionA'))
  .defineRoutes('/collectionB',require('./routes/collectionB'))
  .defineRoutes('/collectionC',require('./routes/collectionC'))
  .map();

The routes have to be build like the follow:

routes/collectionA.js

var item = {
  get : function(req,res){
          ....
    },
    put : function(req,res){

    },
    delete : function(req,res){
        }
};

var collection = {
    get : function(req,res){

    },
    post : function(req,res){
    },
    delete : function(req,res){
    }
};

exports.item = item;
exports.collection = collection;

Bitdeli Badge

Something went wrong with that request. Please try again.