I give up, cannot parse body with bodyParser and express

1,360 views
Skip to first unread message

Rambo

unread,
Aug 7, 2011, 12:18:08 PM8/7/11
to nod...@googlegroups.com
Please help, what the fuck am I doing wrong? the example is so simple and does not work. I tried both using express and connect..

https://gist.github.com/1130500

Thanks for your help.

Tom Blobaum

unread,
Aug 7, 2011, 12:26:51 PM8/7/11
to nod...@googlegroups.com
try req.query


Thomas Blobaum
http://twitter.com/tomblobaum

> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

Rambo

unread,
Aug 7, 2011, 12:57:59 PM8/7/11
to nod...@googlegroups.com
Nice undocumented feature. Connect documentation really sucks, how the hell can i know that?
Post now works by sending the correct content-type headers. Thanks.

Martin Cooper

unread,
Aug 7, 2011, 1:26:14 PM8/7/11
to nod...@googlegroups.com
On Sun, Aug 7, 2011 at 9:57 AM, Rambo <demi...@gmail.com> wrote:
> Nice undocumented feature. Connect documentation really sucks, how the hell
> can i know that?

http://senchalabs.github.com/connect/middleware-query.html

Not exactly voluminous, but not entirely undocumented. :)

Also, on SO:

http://stackoverflow.com/questions/6912584/how-to-get-get-query-string-variables-in-node-js

--
Martin Cooper


> Post now works by sending the correct content-type headers. Thanks.
>

Branko Vukelić

unread,
Aug 7, 2011, 1:28:06 PM8/7/11
to nod...@googlegroups.com
On 2011-08-07 09:57 -0700, Rambo wrote:
> Nice undocumented feature. Connect documentation really sucks, how the
> hell can i know that?

Unfortunatly there are only two ways: ask here or read the source.

--
Branko Vukelic
bra...@herdhound.com
bg.b...@gmail.com

Lead Developer
Herd Hound (tm) - Travel that doesn't bite
www.herdhound.com

Love coffee? You might love Loveffee, too.
loveffee.appspot.com

Tom Blobaum

unread,
Aug 7, 2011, 1:33:15 PM8/7/11
to nod...@googlegroups.com

Ryan Bales

unread,
Aug 7, 2011, 1:00:53 PM8/7/11
to nod...@googlegroups.com
Welcome to working with new technology.


~Ryan Bales



On Sun, Aug 7, 2011 at 11:57 AM, Rambo <demi...@gmail.com> wrote:
Nice undocumented feature. Connect documentation really sucks, how the hell can i know that?
Post now works by sending the correct content-type headers. Thanks.

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en



--
Ryan Bales

Compared to the clouds as they roll by
Compared to the bugs and the spiders and flies
I am an ape man
~The Kinks

tjholowaychuk

unread,
Aug 8, 2011, 12:00:39 AM8/8/11
to nodejs
Reading source works wonders :p IMO you shouldn't use what you wont
read, but yes the documentation blows. Connect is more of a utility
framework anyways it's not really meant to be used directly, it's
built for Express etc. Not sure what you were doing before but yeah
you can't expect it to know how to parse your body without the correct
Content-Type

Pau

unread,
Aug 8, 2011, 5:01:30 PM8/8/11
to nod...@googlegroups.com
Node modules are so small that its easier to read the source than documentation.

Murvin Lai

unread,
Aug 8, 2011, 8:10:08 PM8/8/11
to nod...@googlegroups.com
I recommend you to spend some times, reading the express.js guide. 
Then look at the examples here:

and node here:


and to begin, spend an hour to go through the tutorial  and try out the samples:

if you have question, go to webchat. :)



On Mon, Aug 8, 2011 at 2:01 PM, Pau <mas...@gmail.com> wrote:
Node modules are so small that its easier to read the source than documentation.

--

Benjamin Daghir

unread,
Jan 31, 2017, 3:11:45 PM1/31/17
to nodejs
*********solution************

You cannot name your variable bodyParser or body_Parser or really anything that resembles the words body parser.

Instead, name it something like myParser.

Before:

var bodyParser = require('body-parser');

After:

var myParser = require('body-parser');

Of course everytime you call this variable make sure you use myParser and not bodyParser by accident. So make sure you update your entire file.
:)
Reply all
Reply to author
Forward
0 new messages