Skip to content

Utility functions to generate middleware functions for http-interfaces

Notifications You must be signed in to change notification settings

vsnikkil/generic-middleware-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

generic-middleware-utils

Utility functions to generate middleware functions for http-interfaces. Reduces the amount of work in creating CRUD-style interfaces.

Example

import Koa from 'koa'
import MyModel from './MyModel'
import createInterface from './lib/'

const HTTP_PORT = process.env.HTTP_PORT || 32123
const app = new Koa()
const myModelRouter = createInterface('/my-model', MyModel)

app.use(myModelRouter.routes(), myModelRouter.allowedMethods())

app.listen(HTTP_PORT)

API

createInterface(routerOrPath, pathOrModel, ModelOrUndefined)

Creates endpoints for router.

About

Utility functions to generate middleware functions for http-interfaces

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published