Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crude

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crude

Creates CRUD RESTfull endpoints for a given route

  • 0.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-81.82%
Maintainers
1
Weekly downloads
 
Created
Source

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, expressApp);

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

  • POST /user Create a new user.
  • GET /user Get a list of all the users paginated.
  • GET /user/:id Get a single user item.
  • POST /user/:id Update the user item.
  • DELETE /user/:id Delete the user item.

Documentation

Find the complete API Documentation in the wiki.

Stack

This package assumes you have the following stack:

  • Express

Release History

  • v0.6.0, 08 Sep 2014
    • A complete refactor of the codebase and API has happened, documentation ready, time to hit the spotlight.
  • v0.5.13, 01 Sep 2014
    • Populates total item count for pagination query.
    • Express 4.0 compatible.
  • v0.5.12, 06 Aug 2014
    • No longer assume that readLimit OP result is an array.
    • Invoke the right methods when performing an update
  • v0.5.9, 07 Jul 2014
    • Pagination limit is now configurable via opts.paginateLimit.
  • v0.5.8, 07 Jul 2014
    • if ownUser flag is on then auth is required.
    • upgrade req.host to req.hostname in par with express 4.x
  • v0.5.7, 04 Jul 2014
    • Exclude page and limit query variables.

View the rest of the changelog here.

License

Copyright 2014 Thanasis Polychronakis

Licensed under the MIT License

Keywords

FAQs

Package last updated on 07 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc