Home

Awesome

Crude

Creates CRUD RESTfull endpoints for a given route.

Build Status

Install

npm install crude --save

Quick Start

Crude requires a controller with the following methods and signatures:

var crude = require('crude');

var controller = {
    create: function(data) { return Promise(response); }),
    read: function(query) { return Promise(response); }),
    readLimit: function(query, skip, limit) { return Promise(response); }),
    readOne: function(query) { return Promise(response); }),
    update: function(query, data) { return Promise(response); }),
    count: function(query) { return Promise(response); }),
};

// Create the user CRUD routes
var userCrude = crude('/user', controller);

// Add routes as express middleware
userCrude.addRoutes(expressApp);

That was it, you now have a RESTfull CRUD API under the route /user:

HTTP methods were mapped based on RFC7231 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content: HTTP Method Definitions.

Documentation

Find the complete API Documentation in the wiki.

Stack

This package assumes you have the following stack:

Release History

View the rest of the changelog here.

License

Copyright Thanasis Polychronakis

Licensed under the MIT License