I am running into a problem that seems to be related specifically to Angular 2 and Glitch. I found a workaround, but I thought I would post here to see if someone had insight.

When making HTTP requests via an Angular app (hosted locally as of now, and then sending to the url of the Glitch project), I can’t seem to send anything in the body of the request. The request comes through just fine, and I can specify any of the other “RequestOptions”, but no matter what I do, the body is always just an empty object.

For now, I am passing the data I need as the value attached to the “search” parameter, and then pulling it out of there (using req._parsedUrl.query), but that seems like a messy approach.

Previously, I had a simple version of the app hosted entirely on Glitch, and was using jQuery to send the requests, and this worked just fine. This is what makes me think there is something specific with how Angular2 and Glitch are talking to each other. Or something weird about body-parser?

I am still very new to backend stuff, and honestly to coding in general, so there may be some very obvious thing I am overlooking.

It sends this request to my server on Glitch, where, for this endpoint right now, the code is basically just to log the request to the console. console.log(req.body) always gives {} as output. But, like I said, I’m able to set headers, params, etc. however I need. I do have the body-parser required on the server, and am using it without issue in other places.