[英]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.