16 lines
377 B
JavaScript
16 lines
377 B
JavaScript
const config = require('./config')
|
|
const Koa = require('koa')
|
|
const koaLogger = require('koa-logger')
|
|
const router = require('./route')
|
|
const app = new Koa()
|
|
|
|
app.use(koaLogger())
|
|
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
|