Docs
/
Node Express
Chapter 6

06 — Express Setup & Basics

Core Concepts

  • express() — creates an Express application
  • app.listen() — starts the HTTP server
  • Routingapp.get(), app.post(), app.put(), app.delete()
  • req — request object (params, query, body, headers)
  • res — response object (json, send, status, redirect)
  • Route parameters/users/:idreq.params.id
  • Query strings/users?page=1req.query.page

HTTP Status Codes

RangeMeaningCommon Codes
2xxSuccess200 OK, 201 Created, 204 No Content
3xxRedirect301 Moved, 304 Not Modified
4xxClient Error400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Unprocessable
5xxServer Error500 Internal, 502 Bad Gateway, 503 Service Unavailable