Does anybody know why req.body is empty in my custom express route?
I'm doing a get request to /test. The request is being received correctly, but when I try to extract parameters from the Body, I get nothing
are you sending anything in the body?
Yes, I'm sending a json in the body. And the response is being received. I set that route in server.ts
do you have an
somewhere in your server.ts?
i would also try changing it to
to receive a
personally my get routes usually use URL/query params as opposed to a req body
That worked!! Thanks 😄
The app.use(express.json()); worked.
And about the post, you are right, that is a better practice. This was just a test. In the real function code I'm using a post request. Thanks! 😄