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

restware

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restware

Lightweight REST API framework for Node.js, built on top of connect.

  • 0.0.4
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

restware

Lightweight REST API framework for Node.js, built on top of connect.

Status

Alpha version

Features

  • Lightweight and fast
  • Strict REST
  • Versioned routing
  • Resource expansion

Why not Restify?

Restify is great, but it comes with semver versioning which is not the best choice when it comes to the API, DTrace as a dependency is also not a very good idea and Restify is actually very slow.

Restware tries to implement streight-forward versioning and routing that would make the deployment of new versions and hotfixes easier.

Instead of creating the whole new framework, Restware is actually just a set of middlewares for connect, that means you can choose what you want to use and you can also use other connect middlewares.

Connect is fast and Restware's middleware is also very efficient - it does only what the REST API needs. This makes Restware much faster then Restify (benchmark is comming soon).

Install

$ npm install restware

Usage

var http = require('http'),
  connect = require('connect'),
  restware = require('restware');

var server = connect();

http.createServer(server);

server.use(restware.requestId());
server.use(restware.gzip());
server.use(restware.cors());
server.use(restware.queryParser());
server.use(restware.bodyParser());
server.use(restware.acceptParser());
server.use(restware.authParser());
server.use(restware.rangeParser());
server.use(restware.methodOverride());
server.use(restware.validator());
server.use(restware.requestHandler());
server.use(restware.errorHandler());
server.use(restware.formatter());

// register your controllers
restware.dispatcher.register(1, {
  users: {
    // mapped to GET /users
    getCollection: function (req, reply) {
      reply([...]);
    },
    // mapped to GET /users/:id
    getModel: function(req, reply){
      reply({ id: ... })
    },
    // mapped to PUT /users
    putCollection: function(req, reply){
      
    }
  }
});

server.listen(3000, function () {
  console.log('Listening on port 3000');
});

Examples

For more information about usage see /examples directory where you'll find more about versioning, resource expansion and streaming.

Test

Requires nodeunit

$ npm test

License

MIT

FAQs

Package last updated on 08 Feb 2015

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