如何解决我按照 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 举报,一经查实,本站将立刻删除。