MY CODE
To run:
- Open CMD on your laptop.
- (Assuming you have everything installed) Navigate to the project folder in CMD using cd.
- Type:
node index.ts
- Go to a browser of your choice.
- Click on the address bar.
- Type
localhost:3000
- Your good to go!
What i’m using:
- Node.js
- Express
- Html
- Typescript
- Javascript
- Fetch Api
- (and if it helps) VS Code
What i’m trying to do:
- I’m trying to make a POST request from public/index.html to index.ts using fetch.
The problem:
I get this as an output:
{I got a request!!}
{}
The empty {} should house a latitude & longitude as well as a status.
What I have tried:
- I have tried changing the data that I am fetching (in index.html).
- I have tried hard coding some values/strings in the fetched variables.
- I have tried rearranging the code.
NOTHING WORKS!!!