简体   繁体   English

nodejs无法加载资源:服务器响应状态为404

[英]nodejs Failed to load resource: the server responded with a status of 404

i had this error : Failed to load resource: the server responded with a status of 404 (Not Found) my route is 我遇到此错误:无法加载资源:服务器以404(未找到)状态响应,我的路线是

router.get('/patient/:id', function(req, res, next) {
  var id = req.params.id;
    res.render('patient', { title: 'patient',data:id });
});

my app.js is 我的app.js是

app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/users', usersRouter);

It's super simple. 非常简单。 In your app.js file you use /users for further requests. 在您的app.js文件中,您使用/users进行进一步的请求。 So your URL should be http://localhost:2000/users/patient/18 . 因此,您的网址应为http://localhost:2000/users/patient/18

I hope it helps. 希望对您有所帮助。 Happy Coding :) 快乐编码:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Node.js服务器:无法加载资源:服务器以状态404(未找到)响应 - Nodejs server: Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器响应状态为404(nodejs) - Failed to load resource: the server responded with a status of 404(nodejs) 加载资源失败:服务器以 404(未找到)状态响应 nodejs - Failed to load resource: the server responded with a status of 404 (Not Found) with nodejs 加载资源失败:服务器在koa2和nodejs中以404(未找到)状态响应 - Failed to load resource: the server responded with a status of 404 (Not Found) in koa2 & nodejs 加载资源失败:服务器在 Nodejs 应用程序中响应状态为 404(未找到)问题 - Failed to load resource: the server responded with a status of 404 (Not Found) issue in Nodejs app 加载资源失败:服务器响应状态为 404(未找到) - Ionic2 - Failed to load resource: the server responded with a status of 404 (Not Found) - Ionic2 “无法加载资源:服务器响应状态为404” express docker - “Failed to load resource: the server responded with a status of 404” express docker Heroku:无法加载资源:服务器以状态404(未找到)响应 - Heroku: Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器响应状态为 404 (Not Found) Express - Failed to load resource: the server responded with a status of 404 (Not Found) Express ReactJS Heroku 部署错误:无法加载资源:服务器响应状态为 404(未找到) - ReactJS Heroku Deployment Error: Failed to load resource: the server responded with a status of 404 (Not Found)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM