Skip to content

Tag: post

How to access POST data in express js?

Im using (in the browser): on the client side browser. I’m using (node js): to get the post data. but it doesn’t matter what I send it doesn’t show up. I don’t wanna have to install some separate “body parser” package to see the data…. I don’t wanna parse it. A post request is used to send data to the

why req.body.title shows ‘undefined’

I’m new to NODE JS and practicing with some POST forms from PUG to a NODE JS server. I have a simple form to update a photo title and description posted onto mongodb. When I submit the form from the web browser the submission input comes back to the server as ‘undefined’. These two processes in POST log ‘undefined’: (see

Slack API upload string as file

I have a sting variable of a csv. I want to upload it to a slack channel as a .csv file, not as text. This code returns: error: ‘no_file_data’, Changing content to file gives the same response. What do I have to do to convert the csv sting into a file that can be uploaded? I can’t use fs to

Adding POST parameters after form submit

I have this form: And I’d like to add a few json arrays to POST in validateForm() after validation, so that when validateForm() returns true, the updated POST will be sent to course_submit.php. What’s the best wya to go about this? Thanks! Answer Have <input type=”hidden” …> elements inside the form. Assign the values to those elements.

express post request body shows up as empty

server code client code terminal shows: {} tried pretty much everything so help would be very much appreciated thanks in advance:) Answer You said mode: ‘no-cors’ which tells fetch to silently ignore anything which requires CORS permission. Setting the Content-Type to application/json requires CORS permission so your request is sent with Content-Type: text/plain instead. This doesn’t trigger the JSON body