'use strict';

const koa = require('koa');
const passport = require('./config/passport');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
const compiler = webpack(webpackConfig);
const logger = require('koa-logger');
const serve = require('koa-static');
const routes = require('./config/routes');
const bodyParser = require('koa-bodyparser');
const session = require('koa-generic-session');
const json = require('koa-json');

const app = koa();

app.use(logger());
app.use(bodyParser());
app.keys = require('./config/salt');
app.use(session());
app.use(json());

passport(app);
require('koa-qs')(app);

app.use(require('koa-webpack-dev-middleware')(compiler, {
  publicPath: webpackConfig.output.publicPath,
  noInfo: true
}));

app.use(require('koa-webpack-hot-middleware')(compiler, {
  path: '/__webpack_hmr',
  noInfo: true,
  heartbeat: 10 * 1000
}));


app.use(serve('./public'));

routes(app);

app.listen(3000);

module.exports = app;

'use strict';

const koa = require('koa');
const passport = require('./config/passport');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
const compiler = webpack(webpackConfig);
const logger = require('koa-logger');
const serve = require('koa-static');
const routes = require('./config/routes');
const bodyParser = require('koa-bodyparser');
const session = require('koa-generic-session');

const app = koa();

app.use(logger());
app.use(bodyParser());
app.keys = require('./config/salt');
app.use(session());

passport(app);


app.use(require('koa-webpack-dev-middleware')(compiler, {
  publicPath: webpackConfig.output.publicPath,
  noInfo: true
}));

app.use(require('koa-webpack-hot-middleware')(compiler, {
  path: '/__webpack_hmr',
  noInfo: true,
  heartbeat: 10 * 1000
}));

routes(app);

app.use(serve('./public'));

app.listen(3000);

module.exports = app;

--- 
+++ 
@@ -10,6 +10,7 @@
 const routes = require('./config/routes');
 const bodyParser = require('koa-bodyparser');
 const session = require('koa-generic-session');
+const json = require('koa-json');
 
 const app = koa();
 
@@ -17,9 +18,10 @@
 app.use(bodyParser());
 app.keys = require('./config/salt');
 app.use(session());
+app.use(json());
 
 passport(app);
-
+require('koa-qs')(app);
 
 app.use(require('koa-webpack-dev-middleware')(compiler, {
   publicPath: webpackConfig.output.publicPath,
@@ -32,9 +34,10 @@
   heartbeat: 10 * 1000
 }));
 
-routes(app);
 
 app.use(serve('./public'));
+
+routes(app);
 
 app.listen(3000);
 
Add koa-json module and koa-qs module
