I have a NodeJS server and I want to GET data that is coming from python with the POST method.
pythonData.js
const router = require('express').Router()
router.get("/data",(req,res)=>{
console.log(res)
})
module.exports = router
data.py
import requests
data = {"Car": "BMW","Testing":"API"}
request = requests.post("http://localhost:5000/python/data",data=data)
print(request.status_code)
print(request.text)
but when I run my python file I got an error
404
ErrorCannot POST /python/data
Also how do I get it in my NodeJS
You have implemented a GET method in Node, but you are doing a POST from Python.
Try changing the
router.gettorouter.postin your Express server.