mtfosbot/app.js
2018-08-12 23:31:09 +08:00

18 lines
442 B
JavaScript

const config = require('./config')
const Koa = require('koa')
const koaLogger = require('koa-logger')
const koaSession = require('koa-session2')
const router = require('./route')
const app = new Koa()
app.use(koaLogger())
app.use(koaSession())
app.use(router.allowedMethods())
app.use(router.routes())
const server = app.listen(config.port, () => {
console.log(`server start on port ${server.address().port}`)
})
module.exports = server