Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server 出错 #22

Open
zhonggedan opened this issue Feb 7, 2017 · 1 comment
Open

server 出错 #22

zhonggedan opened this issue Feb 7, 2017 · 1 comment

Comments

@zhonggedan
Copy link

zhonggedan commented Feb 7, 2017

windows
node:6.9.1

执行node app.js没报错,但是一访问http://localhost:3000/test/show 随便访问一个都出现下面的错误,没改动过源码

Not Found

404

Error: Not Found
    at E:\space_react\React-Native-App-master\address_book\server\app.js:56:17
    at Layer.handle [as handle_request] (E:\space_react\React-Native-App-master\address_book\server\node_modules\express\lib\router\layer.js:82:5)
    at trim_prefix (E:\space_react\React-Native-App-master\address_book\server\node_modules\express\lib\router\index.js:302:13)
    at E:\space_react\React-Native-App-master\address_book\server\node_modules\express\lib\router\index.js:270:7
    at Function.proto.process_params (E:\space_react\React-Native-App-master\address_book\server\node_modules\express\lib\router\index.js:321:12)
    at next (E:\space_react\React-Native-App-master\address_book\server\node_modules\express\lib\router\index.js:261:10)
    at SendStream.error (E:\space_react\React-Native-App-master\address_book\server\node_modules\serve-static\index.js:107:7)
    at emitOne (events.js:96:13)
    at SendStream.emit (events.js:188:7)
    at SendStream.error (E:\space_react\React-Native-App-master\address_book\server\node_modules\send\index.js:250:17)`
```
@wayearn
Copy link

wayearn commented Apr 18, 2017

同样的问题,使用如下代码routes.js:

var service = require('./services/test');
var message = require('./services/message');
var user = require('./services/user');
module.exports = function(app){
  service.init(app);
  message.init(app);
  user.init(app);
}

可以打开localhost:3000/test/test

没有使用fs去循环require文件,并初始化routes.

这是为什么?!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants