Registry / web-framework / koa-66

koa-66

JSON →
library1.0.1jsnpmunverified

Router middleware for Koa v2 that supports Express-like HTTP verb methods (get, post, put, delete, all), param middleware, automatic OPTIONS/HEAD responses, 501/405 status codes with headers, and a plugin system for injecting middleware via config objects. It allows mounting routers on paths, supports multiple middleware as arguments or arrays, and can throw errors with status codes. Version 1.0.1 is the latest stable release, targeting Node >= 4. Alternatives like koa-router are more actively maintained.

npm install koa-66
INSTALL
IMPORT
SIG · KOA-66
K
koa-66
web-frameworkjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Router
const Router = require('koa-66')
import Router from 'koa-66'
Package uses CommonJS and has no default ESM export; require() is required for version 1.x.
Router (as named export)
const { Router } = require('koa-66')
const koa66 = require('koa-66'); const Router = koa66.default
Router is exported as module.exports = Router, so destructuring works the same as importing the whole module.
Router (constructor)
const router = new Router()
const router = Router()
Router must be instantiated with new; calling without new will throw an error.

Creates a basic Koa app with a single GET route using koa-66 router.

const Koa = require('koa'); const Router = require('koa-66'); const app = new Koa(); const router = new Router(); router.get('/', async (ctx) => { ctx.body = 'Hello World!'; }); app.use(router.routes()); app.listen(3000); // Visit http://localhost:3000/ => Hello World!
Debug
Known issues
gotchaRouter must be instantiated with `new`.
fix
Use `new Router()` instead of `Router()`.
affects: >=1.0.0
deprecatedThe package has not been updated since 2016 and relies on Node >= 4. It may not be compatible with modern Koa v2 releases.
fix
Consider using koa-router or @koa/router which are actively maintained.
affects: >=1.0.0
gotchaNo ESM support; only CommonJS require() works.
fix
Use `const Router = require('koa-66')` instead of `import Router from 'koa-66'`.
affects: >=1.0.0
breakingThe `mount` method expects a path and a sub-router; passing incorrect arguments may cause silent failures.
fix
Ensure `router.mount('/prefix', subRouter)` is used correctly.
affects: >=1.0.0
gotchaPlugin middleware uses `ctx.state.plugins` which may conflict with other Koa middleware.
fix
Check that no other middleware sets ctx.state.plugins before using plugins.
affects: >=1.0.0
Errors
Common errors & fixes
Router is not a constructor
Calling `Router()` without `new` when the package exports the constructor directly.
fix
Use `new Router()` instead of `Router()`.
require(...) is not a function
Attempting to use `require('koa-66')` as a function (e.g., `require('koa-66')()`) instead of instantiating with new.
fix
Use `const Router = require('koa-66'); const router = new Router();`
Cannot find module 'koa-66'
Package not installed or missing from node_modules.
fix
Run `npm install koa-66` to install the package.
router.routes is not a function
Variable `router` is not an instance of Router (e.g., it's the require() result).
fix
Ensure you create a new Router instance: `const router = new (require('koa-66'))()`
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
koa-66 — npm install koa-66 · libregistry