0.1.2 • Published 6 years ago

express-exorcism v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Express Exorcism

Build Status Coverage Status NPM Downloads

dependencies Status devDependencies Status Codacy Badge

express-exorcism is an Express.js Router wrapper that helps to handle async routes.

NB: Minimal Node version is 7.5.0 with --harmony or 7.6.0.

Installation

npm install express-exorcism --save

or

yarn add express-exorcism

Usage

Run espress-exorcism once before first router usage to wrap entire express. e.g. right after fist express require:

var express = require('express');
require('express-exorcism')(express);
var router = express.Router();
...

or es6

import express from 'express'
import exorcism from 'express-exorcism'
exorcism(express)
const router = express.Router();
...

NB: If you're using import instead of require and express-exorcism is not working for you, it means that express.Router instances are created before express-exorcism wrapper is run. For example if you have import './routes' even after wrapping express - node will run it before.

Singleton wrapper

By default you can wrap express only once with one configuration.

If you need different configurations for different routers or other strange stuff - consider to use singletonRouter option to create router instance wrappers:

var express = require('express');
var router = require('express-exorcism')(express, {singletonRouter: true});
...

or es6

import express from 'express'
import exorcism from 'express-exorcism'

const router = exorcism(express, {singletonRouter: true})
...

NB: router will represent wrapped express.Router() instance, instead of modifying original express.Router methods.

Problems?

Please file an issue on github!

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago