The stubbornest issue in history. please help me. Thanks!
freedom19920918 opened this issue · 0 comments
freedom19920918 commented
when use the command of node to start the server. And problem always occurs.
throw error as fallows:
" Class constructor Application cannot be invoked without 'new'
"
this is my codes(server.js)
`var koa = require('koa');
var app = koa();
var router = require('koa-router')();
//首页---广告
var homeAdData = require('./home/ad');
router.get('/api/homead',function*(next){
console.log('首页广告');
this.body = homeAdData;
})
//开始服务并生成路由
app.use(router.routes())
.use(router.allowedMethods());
app.listen(3000)`
my version of koa:
"koa": "^2.3.0",
"koa-router": "^7.2.1",
my command: node --harmony server.js