tunnckoCore/koa-better-router

View on GitHub
recipes/adding-a-route/example1.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict'

let Router = require('../../index')
let api = new Router() // or just without `new`, it is smart enough

console.log(typeof api.get) // => undefined
console.log(typeof api.put) // => undefined
console.log(typeof api.post) // => undefined

api.loadMethods()

console.log(typeof api.get) // => function
console.log(typeof api.put) // => function
console.log(typeof api.post) // => function