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 trial

JavaScript

Jack Lee
seal-mask
.a{fill-rule:evenodd;}techdegree
Jack Lee
Full Stack JavaScript Techdegree Student 15,536 Points

Express - Set Location Header?

Descrption for the FullStack Javascript Techdregree Project 11 states:

POST /api/courses 201 - Creates a course, sets the Location header, and returns no content

What does it mean by "sets the Location header"?

1 Answer

Bruno Navarrete
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Bruno Navarrete
Full Stack JavaScript Techdegree Graduate 22,246 Points

You just have tu set res 's attributes to tell Postman you have a good response even if '/' is not found:

    res.location('/'); // will set the location header, would return Not Found by default since that route has no response
    res.status(201) // no content status code