@grigorecezar/utils
Common package for handling errors, middlewares, validators, api's across wagel modules.
Last updated 2 years ago by tomtwo .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @grigorecezar/utils 
SYNC missed versions from official npm registry.

Codeship Status for wagel/utils

Utils

A small library that has common code to be shared across wagel modules. It currently supports error handling / errors, middlewares and common API methods.

Installation

List tokens: npm token list Create token: npm token create --read-only Delete token: npm token delete

Read more

https://docs.npmjs.com/getting-started/working_with_tokens

https://docs.npmjs.com/files/npmrc

"utils": "git+https://874d51582870893d902b28357b46aea94f83b653:x-oauth-basic@github.com/wagel/utils.git"

http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules

`http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules

Usage

Errors module

const utils = require('utils')

const errors = utils.errors

  • Throw errors

throw new errors.ValidationError('Password too short.')

throw new errors.AuthError('Wrong credentials.')

throw new errors.BadRequestError('Email field is missing.')

throw new errors.InternalFailureError('Something went wrong.')

Middleware module

const utils = require('utils')

const middlewares = utils.middlewares

  • Register error handler

middlewares.errorHandler(app)(process.env.NODE_ENV)

API wrapper module

const utils = require('utils') const wagelAPI = utils.wagelAPI

Tests

npm test

Current Tags

  • 1.1.5                                ...           latest (2 years ago)

17 Versions

  • 1.1.5                                ...           2 years ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 17
Last Month 21
Dependencies (11)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |