[英]node js Cannot GET “/router”?
app.js app.js
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var userService = require('./models/userService');
app.get('/', function(req, res){
res.sendfile('index.html');
});
app.get('/movie',userService.getUserById);
app.get('/user',userService.getUserById);
I visit "localhost:3000" connect is ok, and "localhost:3000/user" is ok too. 我访问“ localhost:3000”,连接正常,而“ localhost:3000 / user”也正常。 But when I visit "localhost:3000/movie", it give error "Cannot GET /movie".
但是,当我访问“ localhost:3000 / movie”时,出现错误“ Cannot GET / movie”。 I really set that route.
我真的设定了那条路线。
Please restart your app.js
after editing project. 请在编辑项目后重新启动
app.js
So that your route will consider /movie
also. 这样您的路线也将考虑
/movie
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.