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

capishe

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capishe

Utilities for building APIs in express.

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

capishe

Helpers and handlers for building jsonp APIs in express

build status

example

The following examples assume this:

// express 'app' available
var capishe = require('capishe');

noops

Send a noop:

// res.jsonp({}) is sent
app.get('/', capishe.noop());

With custom data:

// res.jsonp({ hello: 'world' }) is sent
app.get('/', capishe.noop({
  hello: 'world'
}));

database

Send data from db with appropriate 200, 500 or 404:

app.get('/', function (req, res) {
  YourModel
    .find()
    .exec(capishe.db(req, res));
});

checks

Check for the presence of a particular URL parameter:

// calls next() becuase present
app.get('/:testParam',
        capishe.check.params('testParam'),
        capishe.noop());

400 errors becuase of missing parameter

app.get('/',
        capishe.check.params('testParam'),
        capishe.noop());

install

npm install capishe

license

MIT

FAQs

Package last updated on 05 Apr 2013

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