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

breakout

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breakout

Gives you one simple way to write an API exposed over multiple transports

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Breakout - API Transport Abstraction

Breakout tives you one simple way to write an API across transports using NodeJS. For instance, you can write one route and one handler function and have it automatically exposed via a json http api and via the NowJS everyone pocket.

Out of the Box

Out of the box you get support for an http json api via Express and a NowJS api. In your configuration simply pass in your instances for each, e.g.


var express = require('express')
  , routes = require('./routes')
var app = module.exports = express.createServer();

var now = require('now');
var everyone = now.initialize(app);

var breakout = require('breakout');
breakout.use('http', app).use('now', everyone);

Defining You API


breakout.map('Fruit.read', function( args, respond ){
  console.log( args );
  respond( { donkey: true } );
});

breakout.map('Fruit.save', function( args, respond ){
  console.log( args );
  respond( { donkey: false } );
});

Server-side Handler Signature


	function( data, respond ){
		// manipulate data
		data  = 'wee';
		// call responder with response	
		respond( myResponse );
	}

TODO

  • be able to handle http route params
  • ability to generate resourceful routes for models

FAQs

Package last updated on 08 Feb 2012

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