@sharyn/koa

2.2.6 • Public • Published

🌹 @sharyn/koa

npm

This package provides a Koa server.

🌹 Install

Minimal:

yarn add @sharyn/koa koa koa-router

Full-featured:

yarn add @sharyn/koa koa koa-router koa-mount koa-static koa-favicon koa-compress

🌹 Usage

startServer, stopServer

import { startServer, stopServer } from '@sharyn/koa'

const routing = router => {
  router.get('*', ctx => {
    ctx.body = `<!doctype html>
    <html>
      <body>
        Hello world!
      </body>
    </html>`
  })
}

startServer(routing) // Starts server on port PORT of your env, defaulting to 8000


// Mute the output with the silent option or change the port in your tests:
setup = () => startServer(routing, { port: 6000, silent: true })
teardown = () => stopServer({ port: 6000, silent: true })

Readme

Keywords

none

Package Sidebar

Install

npm i @sharyn/koa

Weekly Downloads

7

Version

2.2.6

License

MIT

Unpacked Size

13.9 kB

Total Files

4

Last publish

Collaborators

  • sharyn