0.1.1 • Published 4 years ago

koa-toolkit v0.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

Koa Toolkit

npm version npm downloads

An opinionated, batteries-included toolset for efficient Koa API development

npm install koa-toolkit

Purpose

The Koa Toolkit package is intended to provide a way to get a Koa server up and running with as few lines as possible while maintaining middleware flexibility.

This package is currently under development, so PRs are welcome and encouraged!

What's Included

Redux Toolkit includes:

  • A createServer(port, callback) function that returns a new Koa instance with routing and body parsing middleware.
  • A createRouter(options) function that returns a new koa router

Example

const { createServer } = require('koa-toolkit');

const app = createServer();

app.router.get('/', async ctx => {
  ctx.body = {
    hello: 'world',
  }
})

app.listen(3000, () => {
  console.log('> Server listening!');
});