Model
First: initial database connection
Model
Second: Model defination
const Password = Model static { return 'users' } static { return username: } static { return posts: this } static { return 'posts' } static { /** * return false * don't auto update date column */ /** * return true * equals to return ['created_at', 'updated_at'] */ return 'created_at' 'updated_at' } static { return title: contents: } static { return user: this }
Router
const posts = router
Application
// Application inherits from Koa, so app is an instance of Koaconst app = // regular koa middleware// app.use(middleware)app // bodyParser, cors, jsonError & loggerapp appconst server = app
Test
const test = globaltest