Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBenjamin Mercier
270 PointsWhat is the statusCode?
I very new to note. Please someone help me to understand the statusCode!
2 Answers
Dilip Agheda
Full Stack JavaScript Techdegree Graduate 28,581 PointsBenjamin 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 - https://en.wikipedia.org/wiki/List_of_HTTP_status_codes for more info.
remedies
3,616 PointsstatusCode 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"
};
console.log(person.name);
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"....
};
Mark Rinkel
13,501 PointsMark Rinkel
13,501 PointsThey tell you the status of the page. Here's a list: https://www.restapitutorial.com/httpstatuscodes.html