body-parser Questions

11

I don't understand why we need body-parser in an Express application, as we can get data without using body-parser. And what does it do actually and how?
Nagle asked 11/7, 2016 at 12:8

3

Solved

I am creating a web API using Express. The feature is to allow API users to send a file to the server. Here's my app setup code: var express = require('express'); var path = require('path'); // ....
Turner asked 19/7, 2016 at 21:33

3

Solved

As the image shown, BodyParser now is deprecated, how to correct the bodyParser syntax or statement to remove the line-through?
Gangway asked 8/3, 2021 at 6:12

2

Solved

I have the Typescript code below: import * as express from 'express'; import * as bodyParser from 'body-parser'; ... const app: express.Application = express(); app.use(bodyParser.json()); In...
Abeu asked 15/6, 2020 at 20:32

6

Question I'm trying build a Node.js API, when write my server.js file, my code looks like this: var express = require('express'); var express = require('body-parser'); var app = express(); app.us...
Libertarian asked 28/5, 2015 at 4:25

3

Solved

When I send a POST request using postman to localhost:8080/api/newUser with request body: {name: "Harry Potter"} At server end console.log(req.body) prints: { '{name: "Harry Potter"}': '' } s...
Larrainelarrie asked 3/4, 2016 at 17:12

1

I am trying to upload files to a webservice using the Upload scalar in apollo-server-express. I can upload small files(10s of kbs) to the webservice but am having trouble getting larger files to se...
Snowflake asked 1/4, 2019 at 22:24

1

I'm trying to proxy a file upload to firebase cloud functions to not expose our API url. Seems like Firebase is using Body-parser under the hood to parse body in the requests but it's limited to ...

3

Solved

Super stumped by this. I have some server code that for some reason throws a UTF-8 error in my tests but works fine when running the server normally: code: export default ({ projectId = PROJECT_I...
Amersfoort asked 6/3, 2018 at 23:50

4

Solved

So I have the following code in my server.js file that I'm running with node.js. I'm using express to handle HTTP requests. app.post('/api/destinations', function (req, res) { var new_destination...
Raze asked 10/7, 2016 at 17:41

4

Solved

I am a NodeJS beginner, following along a book "Web Development with MongoDB and NodeJS". I am stuck at its chapter 6 with 'multer'. When I use multer for file uploads the server throws the followi...
Sax asked 24/3, 2016 at 14:29

3

I am trying to upload files through my web app using the following code. View: <form name="uploadForm" class="form-horizontal col-sm-12"> <div class="col-sm-4"> <input type="fil...
Helbonia asked 16/7, 2018 at 11:29

1

Solved

I am working on a project that uses strictly imports, disabling me from using required statements. I am wondering how I can read the contents of a post request to my server using the import for Bod...
Hypotonic asked 15/2, 2020 at 7:38

4

Solved

Because I spent some (too much) time figuring out this simple requirement. I am documenting here the way to achieve multipart/form-data body parsing with Koa. In my case, the reason of the confusi...
Riojas asked 17/11, 2015 at 7:17

1

Solved

i want to do following: when user uploads file with form fields too check if form fields are empty, and if it is do not upload file. and i am using this code fileFilter: (req,file,callback) =>{...
Antipas asked 22/5, 2019 at 17:13

1

Solved

After reading about both i still can't wrap my head about it, could be language differences bu please help clarify. express.urlencoded() Returns middleware that only parses urlencoded bodies an...
Peabody asked 15/4, 2019 at 15:4

3

I am working on node based graphql project, trying to send base64 format image to server. I am using bodyparser module and configured it as bellow. app.use(bodyparser.text({type: 'application/gra...
Facsimile asked 5/1, 2017 at 13:30

0

I want to do the implementation to receive multipart/formData in my Node.js server application. For this kind of request, I should be able to receive array of fields for same "key" in form and arra...
Handspring asked 27/2, 2019 at 9:22

2

Solved

I am tryint to resolve a problem a couple of days, but can't understand some things. I have a web site created with NodeJS and ExpressJS, and for handling forms I use body-parser. var adName = r...
Deva asked 18/11, 2014 at 14:10

8

Solved

I see that LoopBack has the Express 3.x middleware built-in. Indeed, body-parser is in loopback/node_modules. But I cannot figure out how to use it as middleware. I have never worked with Express 3...
Latishalatitude asked 15/2, 2015 at 6:58

3

Solved

I'm having trouble with my post from a registration form in node.js. Every time the form is posted the body the request has information but the body is empty. I'm new to node and express so it's pr...
Skiba asked 20/9, 2018 at 16:38

4

Solved

I'm beginning to learn node.js and trying to work out how to get the contents of a POST request. I am trying to follow the instructions in this post. So far I have successfully installed node.js (...
Sincerity asked 5/8, 2015 at 15:38

2

Solved

I'm trying to write a middleware to accept CSP report from browser. Browser issues application/csp-report as Content-Type. The request being posted is JSON format. Currently I use bodyParser.text t...
Heteroclite asked 22/3, 2016 at 20:53

2

Solved

I am sending the following request to my server using postman: I try to access the image in my application using the following code: app.js var express = require('express'); var bodyParser = r...
Arise asked 21/11, 2018 at 16:25

4

Solved

Running an Express API, I'm struggling to parse data including an array of objects correctly when hitting a POST route. A simplified version of the code - var express = require('express'); var a...
Inbeing asked 7/9, 2017 at 18:9

© 2022 - 2024 — McMap. All rights reserved.