2017-12-09 21:51:18 +00:00
|
|
|
import Koa from 'koa'
|
|
|
|
|
|
|
|
import config from './config'
|
|
|
|
import router from './api/router'
|
2017-12-10 09:45:38 +00:00
|
|
|
import { errorMiddleware } from './api/error'
|
2017-12-09 21:51:18 +00:00
|
|
|
|
|
|
|
const app = new Koa()
|
|
|
|
|
2017-12-10 09:45:38 +00:00
|
|
|
app.use(errorMiddleware)
|
2017-12-09 21:51:18 +00:00
|
|
|
app.use(router.routes())
|
|
|
|
app.use(router.allowedMethods())
|
|
|
|
|
|
|
|
const server = app.listen(config.get('server:port'))
|
|
|
|
|
|
|
|
export default server
|