New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jsender-plus

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsender-plus

A few more Express response helper methods for JSender.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

JSender +

A few more Express helper methods for JSender.

Methods add specific HTTP Status Codes.

Installation

npm install --save jsender-plus

Usage

var express = require('express')
  , jsender = require('jsender')
  , jsenderPlus = require('jsender-plus')

var app = express()

app.use(jsender())
app.use(jsenderPlus())

app.post('/users', function (req, res) {
 
  // some logic here
  // ...
  // fails validation
  if (errors)
    return res.failValidation(errors)

  // on success
  res.successCreated(data)
})

API

res.successCreated(data)

  • data: Optional object to send in JSON response.

HTTP Status: 201

res.failValidation(data)

  • data: Required object of validation errors to send in JSON response.

HTTP Status: 400

res.errorNotFound(item, data, code)

  • item: Optional string stating item that cannot be found.
  • data: Optional object
  • code: Optional number

HTTP Status: 404

License

MIT

Keywords

FAQs

Package last updated on 27 May 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