405 error encountered when using Fetch POST data to the server in Express and Node - looking for a solution
P粉311423594
P粉311423594 2024-04-01 21:31:33
0
2
462

I'm using Express and Node. Use Fetch to POST some data to the server. I'm getting a 405 error. I don't know how to solve this problem.

P粉311423594
P粉311423594

reply all(2)
P粉043432210

From what I can see in the screenshot, your node application is running on port 3000, but the error on the console indicates that you are getting a 405 error on localhost, but the port 5501.

Is it possible that you are trying to access the wrong URL?

P粉256487077

Just get the node app from "app.listen" by editing:

fetch('api', options)

to

fetch('http://localhost:3000/api', options)

index2.html Line 27

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template