简体   繁体   English

Postman 发布请求在发送时卡住

[英]Postman post request stuck on sending

(Express) Hello I'm trying to make a very simple post request to localhost via postman but it gets stuck on sending. (Express) 您好,我正在尝试通过 postman 向 localhost 发出一个非常简单的发布请求,但它在发送时卡住了。 To be clear, the first time I've tried it, it worked, but after adding a mongoose implementation it didn't work anymore even after commenting the changes.需要明确的是,我第一次尝试它时,它起作用了,但是在添加了 mongoose 实现之后,即使在评论更改后它也不再起作用了。

const router = require('express').Router();

router.post('/', (req, res) => {
    console.log("Got here");
    res.send("ciao");
});
 
app.listen(port, () => {
    console.log("Server running on port: " + port);
});

If it was working correctly I'd see "Got here"如果它工作正常,我会看到“到了这里”

Postman app Postman 应用程序

I'm using postman 8.0.2 desktop app for mac, i've tried to remove and install again.我正在使用适用于 mac 的 postman 8.0.2 桌面应用程序,我尝试删除并再次安装。

EDIT I've tried creating another project and it works again i'll investigate on what i did wrong and maybe add a comment.编辑我已经尝试创建另一个项目并且它再次工作我将调查我做错了什么并可能添加评论。

add router as middleware to the express, below is your updated code将路由器作为中间件添加到快递中,下面是您更新的代码

const router = require('express').Router();

router.post('/', (req, res) => {
    console.log("Got here");
    res.send("ciao");
});

app.use('/', router);
 
app.listen(port, () => {
    console.log("Server running on port: " + port)
});

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

相关问题 Postman 卡在发送请求上 - Postman Stuck on sending request 从 POSTman 发送 POST 请求是否不同于从 Android (Java) 发送 POST 请求? - Is Sending a POST request from POSTman different from sending a POST request from Android (Java)? PostMan 向 Express 服务器发送 JSON post 请求中的空主体 - PostMan sending empty body in JSON post request to the Express server 通过 Postman 发送 API 请求? - Sending API request via Postman? 向 Postman 发送请求时出错 - Error when sending a request to the Postman 通过Axios发送发布请求会在Spring-Boot后端生成一个空的RequestBody。 在Postman中工作,但不能通过Axios发布请求工作 - Sending a post request through Axios is generating an empty RequestBody in Spring-Boot backend. Works in Postman but not through Axios post request 在 Postman GET 工作正常,但 POST 方法继续发送请求。 使用 ZCCADCDEDB567ABAE643E15DCF0974E503Z、Javascript - In Postman GET working fine but POST method keeps on sending request. Using Mongoose, Javascript 在 Postman 上的 Get 请求上加载“发送请求” - “Sending request” loading on Get request on Postman 发布请求在 Postman 中有效,但在 Javascript 中无效 - Post Request Works in Postman But Not in Javascript 邮递员 - 带有文件上传的 POST 请求 - Postman - POST request with file upload
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM