当我搜索 `localhost:3000/users` 时,它说没有找到。怎么了?

ZHONGJIAFENG

在此处输入图片说明 在此处输入图片说明

app.use()在 app.js 和router.get()users.js 中使用 Express 框架当我搜索时localhost:3000/users/u它工作正常,但是当我搜索时localhost:3000/users,它是一个 404 错误。怎么了?

桑德罗·蒙达

这是因为/users调用重定向到您的users.js模块,而您没有处理/它。要解决此问题,只需添加路由:

// users.js

router.get('/', function (req, res) {
  console.log('It works');
  // ...
});

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

当我把它放在一个包中时没有找到 .js 文件

当我尝试访问URL时,Rails日志在Puma的终端中未显示任何内容:localhost:3000

当我运行“React”时,它说端口 3000 正在使用中

当我指定“ -h localhost”时无法登录到PostgreSQL

http:// localhost:3000 /#!/为什么我在localhost链接中得到“#!/”。

我在 php 中登录时遇到问题。当我在 localhost 中测试它时,登录页面工作正常。但是当我将它上传到服务器并进行测试时,它没有用

GET http://localhost:3000/:/localhost:4000 404(未找到)

当我在 localhost:5000 中运行它时,我的 html 站点中的所有文本都作为链接出现

当我搜索土耳其语单词时,它没有突出显示,但英语却突出显示了

当我使用 Button 方法时,'visible=>true' 没有找到可见按钮

POST http:// localhost:3000/404(未找到)

为什么我不能在React中使用axios从localhost:3000调用localhost localhost:5000

我收到错误 GET http://localhost:3000/api/products 404(未找到)

ruby - 运行 http://localhost:3000/admin/users 但redirect_to http://localhost:3000/admin/login

带有AngularFire的localhost:3000 / traceur SystemJS

当我按Enter键时,我想搜索表格

Grafana 正在生成带有基本 URL 的链接:http://localhost:3000 而不是使用我的 url

在Typescript中,为什么我的通用抽象类在尝试实现它时没有找到类型参数?

当我使用localhost连接时,如果我使用IP,它将无法连接

当我尝试使用 event.type 时,它说“模块”对象没有类型属性

PostgreSQL全文搜索没有找到它应该找到的一些词

我从(/ etc / hosts)中删除了(127.0.0.1 localhost)以外的所有内容,然后重新启动。但是当我登录时它仍然是(root @ name)

当我浏览站点时(在localhost上),图像在某一点损坏

当我尝试“ ssh localhost”或“ source〜/ .bashrc”时,“无法连接到X服务器”

当我在 localhost 中键入文件夹名称时如何首先显示登录系统的 sysntax

使用react-router和react-router-redux 当我转到localhost:9000 /时,它工作正常,但不是localhost:9000 / login

当我尝试打开 file.sumocfg 时,Sumo 没有找到 file.net.xml

從源“http://localhost:62521”訪問“localhost:3000/users”的 XMLHttpRequest 已被 CORS 策略阻止

代理错误:无法将请求 /users 从 localhost:3000 代理到 http://localhost:3001/