npm.io
3.1.0 • Published 8 years ago

uh-responder

Licence
MIT
Version
3.1.0
Deps
6
Vulns
1
Weekly
0

uh-responder

Urbanhire API helper for give json response success or error

Usage

const uhResonseder = require('uh-responder')
app.use(uhResonseder())

// example response json output
const output = {
  users,
  companies
}

res.UHJson(output, extraData)


// example output with extraData fields

const output = {
  users,
  companies
}

const extraData = {
  success: true
}

res.UHJson(output, extraData)


// example error response api

res.jsonError(new Error('Applicant Id is required'), 400)

This project uses JavaScript Standard Style - if the name or style choices bother you, you're gonna have to get over it :)

js-standard-style