节点js无法GET" / router"?

时间:2014-12-23 09:09:45

标签: node.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);

我访问" localhost:3000" connect是好的," localhost:3000 / user"还可以。 但是当我访问" localhost:3000 / movie"时,它会给出错误"无法获取/电影"。 我真的设定了这条路线。

1 个答案:

答案 0 :(得分:0)

编辑项目后,请重新启动app.js。因此,您的路线也会考虑/movie