@trop/async_router

0.2.0 • Public • Published

async_router

Asynchronous Router for Express - Make async/await handlers simple.

Features

  • Wrap handlers, allow async/await calling.

Usage

const Router = require('@trop/async_router')
const express = require('express')

let router = new Router()

router.
get('/', async(req, res) => {
    let items = await service.fetch()
    res.json(items)
})

let app = express()

app.use('/api', router.express)
app.listen(8080)
  • service.fetch(), an async operation.
  • router.express, retrieve express router.

Documents

Readme

Keywords

Package Sidebar

Install

npm i @trop/async_router

Weekly Downloads

1

Version

0.2.0

License

ISC

Unpacked Size

5.03 kB

Total Files

8

Last publish

Collaborators

  • kevin.leptons