1.1.0 • Published 8 years ago

kro v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

KRO Build Status

Simple routing for Koa@next

import Koa from 'koa'
import { GET, POST, useRoutes } from 'kro'

const routes = {
  @GET('/true')
  getTrue (ctx) {
    ctx.body = { test: true }
  },

  @GET('/false')
  getFalse (ctx) {
    ctx.body = { test: false }
  },

  @POST('/api')
  api (ctx) {
    ctx.body = { version: 1 }
  }
}

const app = new Koa()

// Built-in useRoutes
useRoutes(app, routes)
// or app.use
app.use(routes.getTrue)
app.use(routes.getFalse)
app.use(routes.api)
// Not both

app.listen(3000)
1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago