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 9010659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:31:16+00:00 2026-06-16T02:31:16+00:00

I am learning nodejs and express, during my studies I don’t understand various uses

  • 0

I am learning nodejs and express, during my studies I don’t understand various uses of req such as:

var id = req.params.id;
var wine = req.body;

With my req object I think am acessing body, params.id, but I do not understand how this works and what result I should expect. Can anyone explain this code in a simpler step by step manner so i can make sense of it ?

Below is some example code where the above is used :

 exports.addDoctor = function(req,res){
        var doctor = req.body;
        console.log(doctor);
            db.collection('doctors',function(err,collection){
            collection.insert(doctor,{safe:true},function(err,result){
                if (err) {
                    res.send({'error':'An error is occured'});
                } else {
                    console.log('Success: ' + JSON.stringify(result[0]));
                    res.send(result[0]);
                }
            });
        });
    }

In the above example console.log(doctor) only returns {}. Why is this and is it because I have missed something else within the code specifically involving ‘req’?

  • 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-16T02:31:18+00:00Added an answer on June 16, 2026 at 2:31 am

    req is the request object. It’s documented here: http://expressjs.com/api.html#req.params

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

Sidebar

Related Questions

I am just learning mongodb-native driver for nodejs. I connect like this. var mongo=require(mongodb)
I have been learning NodeJS recently. It seems to be standard in the Node
I am learning NodeJS and was able to make a server and an iPhone
I am a beginner learning NodeJS. I am sure that the scripting language has
NodeJS + Express, MongoDB + Mongoose I have a JSON feed where each record
I'm learning node.js with express and ejs template. While I'm learning some code I
I'm in the process of learning Node.js and have been playing around with Express
I am learning nodejs at the moment on Windows. Several modules are installed globally
I'm learning node.js now. Whenever I ran node example.js it says http.js:529 var key
I am learning erlang and I stumbles over some behaviour I cannot quite understand.

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.