# kenote-express-helper

> Express's Helper.

Latest version **1.1.3** (published 2020-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install kenote-express-helper
pnpm add kenote-express-helper
yarn add kenote-express-helper
bun add kenote-express-helper
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2020-08-24 |
| First published | 2018-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >8.0.0 |
| Dependencies | 2 |
| Unpacked size | 35.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | thondery |
| Maintainers | thondery |
| Keywords | kenote, express, helper, assistant, typescript |

## Links

- npm: https://www.npmjs.com/package/kenote-express-helper
- Repository: https://github.com/kenote/express-helper
- Homepage: https://github.com/kenote/express-helper#readme
- Issues: https://github.com/kenote/express-helper/issues
- npm.io page: https://npm.io/package/kenote-express-helper

## Dependencies (2)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [immutable](https://npm.io/package/immutable.md) ^4.0.0-rc.12

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2020-08-24
- 1.1.2 — 2019-12-12
- 1.1.1 — 2019-07-03
- 1.1.0 — 2019-07-03
- 1.0.5 — 2019-02-05
- 1.0.4 — 2019-02-05
- 1.0.3 — 2019-01-11
- 1.0.2 — 2019-01-07
- 1.0.1 — 2018-12-26
- 1.0.0 — 2018-12-18

## README

# express-helper

Express's Helper.

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Gratipay][licensed-image]][licensed-url]

## Installation

```bash
$ npm install kenote-express-helper
# Or
$ yarn add kenote-express-helper
```

## Usages

`controller/account.ts`

```ts
import { Request, Response, NextFunction } from 'express'
import { Controller, Path, Router, Filter } from 'kenote-express-helper'
import accountFilter from '../filters/account'
import { IResponse } from '../middleware/restful'

@Path('/account')
export default class Account extends Controller {

  @Router({ method: 'get', path: '/home' })
  public home (req: Request, res: Response, next: NextFunction): Response {
    return res.json({ test: 'ok' })
  }

  @Router({ method: 'post', path: '/login' })
  @Filter(accountFilter.login)
  public login (document: any, req: Request, res: IResponse, next: NextFunction): Response {
    return res.api(document)
  }

  @Router({ method: 'get', path: '/help' })
  public help (req: Request, res: IResponse, next: NextFunction): void {
    return res.notfound()
  }
}
```

`controller/index.ts`

```ts
import { MountController } from 'kenote-express-helper'
import Account from './account'

export default MountController( Account )
```

`filters/account.ts`

```ts
import { Request, Response, NextFunction } from 'express'

class Account {

  public login (req: Request, res: Response, next: NextFunction): Response | void {
    return next({ test: 'ok' })
  }
}

export default new Account()
```

`app.ts`

```ts
import * as http from 'http'
import * as express from 'express'
import { Application } from 'express'
import { mountPipeline } from 'kenote-express-helper'
import restful from './middleware/restful'
import controller from './controller'

const app: Application = express()
app.use(restful)

// Auto Routing
mountPipeline('/api/v1', 'controller', app, { root: 'src' })

// Manual Routing
app.use('/api/v2', controller)

http.createServer(app).listen(3000)
```

## License

this repo is released under the [MIT License](https://github.com/kenote/express-helper/blob/master/LICENSE).

[npm-image]: https://img.shields.io/npm/v/kenote-express-helper.svg
[npm-url]: https://www.npmjs.com/package/kenote-express-helper
[downloads-image]: https://img.shields.io/npm/dm/kenote-express-helper.svg
[downloads-url]: https://www.npmjs.com/package/kenote-express-helper
[travis-image]: https://travis-ci.com/kenote/express-helper.svg?branch=master
[travis-url]: https://travis-ci.com/kenote/express-helper
[licensed-image]: https://img.shields.io/badge/license-MIT-blue.svg
[licensed-url]: https://github.com/kenote/express-helper/blob/master/LICENSE

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