@saber2pr/koa-router
v0.0.7
Published
> router for @saber2pr/koa.
Downloads
5
Readme
@saber2pr/koa-router
router for @saber2pr/koa.
# from npm
npm install @saber2pr/koa-router
# from github
git clone https://github.com/Saber2pr/-saber2pr-koa-router.git
API
route(path)(async ctx
route.get(path)(async ctx
route.post(path)(async ctx
route.del(path)(async ctx
route.put(path)(async ctx
Koa()
.use(
route('/')(async ctx => {
ctx.response.end('helloworld!')
})
)
.use(
route.get('/get')(async ctx => {
ctx.response.end('get!')
})
)
.use(
route.post('/post')(async ctx => {
ctx.response.end('post!')
})
)
.use(
route.del('/del')(async ctx => {
ctx.response.end('del!')
})
)
.use(
route.put('/put')(async ctx => {
ctx.response.end('put!')
})
)
.listen(3004, () => console.log('http://localhost:3004'))
start
npm install
npm start
npm test
Author: saber2pr
develope and test
you should write ts in /src
you should make test in /src/test
export your core in /src/index.ts!