score:0
try enabling cors and setting application/json headers. You need to have cors enabled to reach a 3rd ip. Also you need to fit their headers. Try looking deeper into the requirements of the weather api and try with POSTMAN first, and if that works you can get the headers using the output "code" selection. You dont have to make an account with postman, even though it tries to make you.
score:0
Thanks to all the help, I think pavan kumar's comment pointed me to the correct direction. After adding this line let coord = req.body.coord;
to the post method, I was able to see the request body by console.log(coord)
:
{ latitude: 50, longitude: -2.1 }
The 500 internal server error was caused by calling coord[0]
and coord[1]
, as coord
was an object rather than an array. The error disappeared after changing to
coordinates = `lat=` + coord.latitude + `&lon=` + coord.longitude;
Thanks again.
Source: stackoverflow.com
Related Query
- 404 error while sending data from React to Node?
- Sending data from react server to node server
- Trouble with sending data from react to node
- Too many re-renders React error while fetching data from API
- Error "Cannot read property 'map' of undefined" while trying to read & display data from firestore via my react app
- getting error while destructuring the data from react redux. why it is giving error and how to solve this?
- Error 404 POST form data from react to express
- Error while making a request from React server to node Server
- am getting an error props.onSubmitForm is not a function while trying to pass data from child to parent component in react
- Name error data is not defined when sending POST request values from react to flask
- Sending data from a form in React to DyanmoDB via AWS Lambda with Node
- Sending data back from node server back to react frontend
- sending data in correct format from react to node
- Sending Data from React to MySQL
- How to redirect to 404 if no data from external API (universal React + Redux app)?
- Sending data from Express to React through a redirect
- ReactJS: Error while extracting data from JSON file
- How do I send data from React to Node server and back result to React?
- React - Axios is sending file data as undefined to a Node server
- Sending data from React form to Django Rest Framework without a Model
- How to fix the state update in react while getting data from firestore database
- Image tag not working in react while sending image path from rails backend
- Using base64 Encoding When Passing Data from Node to React to Construct PDF
- Error resolving module specifier: react while doing dynamic import from API
- Serving a React app from Node while also having an API
- How to return json data from 400 error to React from Express?
- Accessing Upload Data in React From Multer Node Server
- React JS Unexpected end of JSON input error when binding data from an API
- Getting a different port ERROR in the console while uploading image from the frontend using react js to the Mongo db
- get data attribute from “root” DOM node in react js
More Query from same tag
- Render image with json data | ReactJs
- Search in the multiply tree view doesn't work properly
- How to render React Route component in an entirely new, blank page
- How do you pass/receive route props in components?
- what is the equivalent of this.props.history.push('/some_route') of react class components in hooks?
- Conditional routing with ReactRouter in React
- Manipulating JSON in React
- React, component not re-rendering after change in an array state (not the same as others)
- npm install -g expo-cli fails with "EPERM: operation not permitted, unlink '...\adb.exe'
- Redux Form Material UI: Select with Nested Lists not working
- React <img /> tag not showing image
- Routing in ReactJS
- React Redux Typescript error with AnyAction when implementing Redux-Persist
- `react-scripts build' is using 1+ GB of RAM
- setState update value but displays old value
- Change width of range slider thumb based on JavaScript variable
- How to change only the class i pressed on
- Spring + React fetch data
- Ant Design notification does not support translation component
- Show next items from json array
- Unable to play a different song using setState method in ReactJs
- Host frontend (react) and backend (ASP.NET Web Api) under the same Website in IIS
- convert datetime from one offset to another offset
- react-rails gem pass hash in view helper react_component
- HOC does not set proper value
- How to get the changed state after an async action, using React functional hooks
- Stopping event propagation in Reactjs
- How import and export components (functions) in ReactJS?
- How to write function type definitions for anonymous functions in typescript?
- How do I give axios interceptors access to my react app's state?