Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:01:24+00:00 2026-06-01T00:01:24+00:00

I was working on a simple API using Node.JS and Restify tonight and had

  • 0

I was working on a simple API using Node.JS and Restify tonight and had everything fine in terms of receiving parameters via req.params.fieldname. I installed CouchDB and Cradle in order to start trying to throw those parameters into a database, but after getting everything installed req.params started to come back empty!

I should have been using Express to begin with for other reasons, so I tried switching to that to see if I could get it working but no such luck.

var express = require('express');
var app = express.createServer();

app.configure(function(){
app.use(express.bodyParser());
app.use(express.cookieParser());
});

app.post('/', function(req, res){
  res.send(req.body);
});

app.listen(8080, function() {
  console.log('Printomatic listening at', app.url);
});

I’ve tried countless variations but no matter what req.body comes back empty. I’m using http-console to test, and sending things as simple as POST / with content {"name":"foobar"}

I’m so frustrated that at this point I’m beginning to wonder if I broke something when installing Cradle/CouchDB (which were installed with NPM and Homebrew, respectively). Any help would be greatly appreciated as this is somewhat time-sensitive. Thanks for any help in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:01:26+00:00Added an answer on June 1, 2026 at 12:01 am

    You mention that you post JSON data ({"name": "foobar"}). Make sure that you send Content-Type: application/json with that, or bodyParser will not parse it.

    E.g.:

    $ curl -d 'user[name]=tj' http://local/
    $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/
    

    This is because bodyParser parses application/json, application/x-www-form-encoded and multipart/form-data, and it selects which parser to use based on the Content-Type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple wikipedia autocomplete using the wikipedia's API. Currently it is working
I'm working on copy to clipboard using the zeroclipboard api,. I made a simple
I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display
I developed a simple ASP.NET app, it was working fine, but now I can't
I'm using the flickr api to create a simple gallery based on images pulled
I am making this simple get request using jquery ajax: $.ajax({ url: https://app.asana.com/-/api/0.1/workspaces/, type:
I'm working on developing a node.js app using mongoDB as a database. I'm working
I'm working on a simple API that will accept a number of IBehaviours which
I made a simple javascript translator using google API. Instead of using a button
I need to replicate the following working HQL query using criteria API. session.CreateQuery( select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.