我按照 koa 教程并复制它,但是为什么我在输入 localhost:3001/hello 时看到“未找到”?

问题描述

//I follow a koa tutorial and just copy and paste it,but it can not run,why ?and how to solve it?

var koa = require('koa');
var router = require('koa-router');
var app =  new koa();
var _ =  router();              //Instantiate the router
_.get('/hello',getMessage);   // Define routes
function *getMessage() {
this.body = "Hello World!";
               };
app.use(_.routes());           //Use the routes defined using the router
app.listen(3001);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)