Created
March 3, 2016 10:35
-
-
Save NikolayGalkin/8b9ae83e89cc8bd4b9d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Koa from 'koa'; | |
import logger from 'koa-logger'; | |
import bodyparser from 'koa-bodyparser'; | |
import error from 'koa-error'; | |
import convert from 'koa-convert'; | |
import Debug from 'debug'; | |
import config from './lib/config'; | |
import db from './lib/db'; | |
import router from './lib/router'; | |
export const app = module.exports = new Koa(); | |
const debug = new Debug('app:main'); | |
app.use(convert(error())); | |
app.use(logger()); | |
app.use(bodyparser()); | |
app.use(config(app)); | |
app.use(db(app)); | |
app.use(router(app)); | |
if (!module.parent) { | |
app.listen(app.config.app.port, app.config.app.host, function cb() { | |
debug(`Listen ${app.config.app.host}:${app.config.app.port}`); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('babel-core/register'); | |
require('babel-polyfill'); | |
const Debug = require('debug'); | |
const app = require('./app'); | |
const debug = new Debug('app:main'); | |
app.listen(app.config.app.port, app.config.app.host, function cb() { | |
debug(`Listen ${app.config.app.host}:${app.config.app.port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment