# zero-request

> Provide enhanced express router functions for relier module.

Latest version **0.2.4** (published 2015-10-14) · 0 weekly downloads

## Install

```sh
npm install zero-request
pnpm add zero-request
yarn add zero-request
bun add zero-request
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2015-10-14 |
| First published | 2014-10-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | jiamiu |
| Maintainers | sskyy |
| Keywords | zero module |

## Links

- npm: https://www.npmjs.com/package/zero-request
- npm.io page: https://npm.io/package/zero-request

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) ~3.10.1
- [koa-body](https://npm.io/package/koa-body.md) ~1.2.1
- [roof-bus](https://npm.io/package/roof-bus.md) ~0.1.0
- [koa-router](https://npm.io/package/koa-router.md) ~5.2.0
- [koa-session](https://npm.io/package/koa-session.md) ~3.3.1

## Recent versions

- 0.2.4 (latest) — 2015-10-14
- 0.2.3 — 2015-10-12
- 0.2.2 — 2015-10-12
- 0.2.1 — 2015-10-12
- 0.2.0 — 2015-09-01
- 0.0.13 — 2014-12-22
- 0.0.12 — 2014-12-19
- 0.0.11 — 2014-12-11
- 0.0.10 — 2014-11-28
- 0.0.9 — 2014-11-27
- 0.0.8 — 2014-11-14
- 0.0.7 — 2014-11-03
- 0.0.6 — 2014-10-25
- 0.0.5 — 2014-10-17
- 0.0.4 — 2014-10-17
- … 2 more at https://npm.io/package/zero-request/versions

## README

# zero-request #

Provide enhanced express router functionality for relier module.

## Usage ##

1. Add dependency to your module package.json file like:

```
{
	"name" : "YOUR_MODULE_NAME",
	"zero" : {
		"dependencies" : {
			"request" : "^0.0.1"
		}
	}
}
```

2. Declare `route` in model definition like:

```
module.exports = {
    route : {
        "GET /anyUrl" : function( req, res){
            //use it just like express router
        },
        "GET /runInOrderUrl" : {
            "function" : function functionName(req, res){
                //this handler will run before otherModule.otherFunctionName
            },
            "order" : {
                before : "otherModule.otherFunctionName"
            }
        },
        "GET /fireEvent" : function (req, res){
            //with bus module loaded, you can use req.bus to fire event
            req.bus.fire("someEvent")
        },
        "GET /fcall" : function( req, res){
            //bus.fcall will help you fire event before and after your main business logic
            req.bus.fcall("someEvent", arg1, arg2, function(){
                //deal what you want to do
            })
        }
    }
}
```

We strongly suggest you to use `bus.fire` or `bus.fcall` to trigger the action you want, this will decouple your system in an elegant way.
Know more a about [bus](http://github.com/sskyy/zero-bus).

---
_Source: https://npm.io/package/zero-request · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
