JavaScript Node.js Basics Building a Command Line Application Getting the Response Body

What is the statusCode?

I very new to note. Please someone help me to understand the statusCode!

They tell you the status of the page. Here's a list:

2 Answers

Dilip Agheda
Dilip Agheda
Full Stack JavaScript Techdegree Graduate 26,960 Points

Benjamin Mercier status code is not a node specific concept. it is more related to HTTP protocol in general. statusCode basically means that every time, when a http request is made it results in a response that has some sort of status code to indicate what happened to that http request.

in a typical scenario, when http request is successful, status code is 200 which means "OK". similarly 404 means file not found. checkout this wiki - for more info.

3,613 Points

statusCode is an object property related to HTTP requests. Basically, when making an HTTP request, you get a response object. This response object contains properties that you can access.

It's just like any other javascript object. This:

var person = {
    name : "John Doe",
    number : "123-1231"


would return the person's name. Imagine the response object being structured the same way. It would contain various properties and methods.

var response = {
    statusCode : "200"....