@saber2pr/koa-router

0.0.7 • Public • Published

@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

  1. route(path)(async ctx

  2. route.get(path)(async ctx

  3. route.post(path)(async ctx

  4. route.del(path)(async ctx

  5. 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!

Readme

Keywords

Package Sidebar

Install

npm i @saber2pr/koa-router

Weekly Downloads

0

Version

0.0.7

License

ISC

Unpacked Size

7.54 kB

Total Files

6

Last publish

Collaborators

  • saber2pr