-
Micro.
-
Elegant.
-
Fast.
-
Lightweight.
-
Expressive.
$ npm install trek-engine
const co = require('co')
const Engine = require('trek-engine')
const app = new Engine()
// middleware
app.use((ctx, next) => {
// return promise
return next()
})
// async/await
app.use(async (ctx, next) => {
await next()
})
// generator
app.use(co.wrap(function * (ctx, next) {
yield next()
}))
// response
app.use({ res } => {
res.end('Hello Koa')
})
app.run(3000)See express vs koa vs toa vs trek-engine.
-
express
-
koa v2
-
toa
-
trek-engine