jithin surendran
jithin surendran

Reputation: 45

I was working with Express and node. Using Fetch to POST some data to server. I'm getting 405 err. I havent got any idea on how to solve this

I was working with Express and node. Using Fetch to POST some data to server. I'm getting 405 err. I havent got any idea on how to solve this. enter image description here

enter image description here enter image description here

Upvotes: 0

Views: 70

Answers (2)

Nico
Nico

Reputation: 421

For what I can see on your screenshot, your node application is running on the port 3000, but the error on the console says your are getting a 405 error on the localhost but port 5501.

Is possible that you are trying to reach the wrong url?

Upvotes: 1

Antek Pietryga
Antek Pietryga

Reputation: 356

Just fetch node app from "app.listen" by editing:

fetch('api', options)

to

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

on index2.html on line 27

Upvotes: 1

Related Questions