uh-responder

3.1.0 • Public • Published

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

Dependencies (6)

Dev Dependencies (2)

Package Sidebar

Install

npm i uh-responder

Weekly Downloads

10

Version

3.1.0

License

MIT

Last publish

Collaborators

  • hengkiardo
  • uh-engineer