Home/Tutorials/Express/REST JSON APIs

0 of 3 saved

Express5 min read

REST JSON APIs

Read this chapter, write the program on this page, then pass a short check to open the next one.

Resources and verbs.

REST JSON APIs

REST maps HTTP verbs to actions: GET read, POST create, PUT/PATCH update, DELETE remove. Return JSON and proper status codes.

  • 201 Created for successful POST.
  • 400 for bad input; 401/403 for auth; 500 for unexpected errors.
  • Keep URLs noun-based: /tasks, /tasks/:id.
const status = 201;
console.log(status, "created");

After you read this chapter, use Write (when available) and Quiz on this page to lock it in.