Skip to main content

Command Palette

Search for a command to run...

πŸ“˜ Web Development Notes (JavaScript Backend)

Published
β€’2 min readβ€’View as Markdown

βœ… HTTP Methods

HTTP methods define what action the client wants to perform on the server.

MethodPurpose
GETRetrieve data (read-only)
POSTSend data to create a resource
PUTUpdate/replace an existing resource
PATCHUpdate (partial) a resource
DELETERemove a resource

πŸ”— Communication Protocols

ProtocolPurpose
HTTPStandard request-response communication over the web
WebSocketsFull-duplex communication (real-time apps: chat, games)
WebRTCPeer-to-peer audio, video, and data sharing (used in video calls)
gRPCHigh-performance remote procedure call protocol (used in microservices)

πŸ“Ÿ HTTP Status Codes

Status codes are 3-digit responses returned by the server to indicate the result of the request.

βœ… 1. 200 Series β€” Success

  • 200 OK: Request succeeded

  • 201 Created: Resource created

  • 204 No Content: Success, no data returned

πŸ” 2. 300 Series β€” Redirection

  • 301 Moved Permanently

  • 302 Found (Temporary redirect)

❌ 3. 400 Series β€” Client Error

  • 400 Bad Request

  • 401 Unauthorized

  • 403 Forbidden

  • 404 Not Found

πŸ› οΈ 4. 500 Series β€” Server Error

  • 500 Internal Server Error

  • 502 Bad Gateway

  • 503 Service Unavailable


πŸ›£οΈ Routes

  • Routes define what endpoint/path is used and what happens when it is hit.

  • They map incoming HTTP requests to specific handler functions.

Example:

jsCopyEditapp.get('/todos', getAllTodos);    // Fetch todos
app.post('/todo', createTodo);     // Add a todo
app.delete('/todo/:id', deleteTodo); // Delete by ID

Routing is the mechanism Express (or any web framework) uses to match a URL and method with the appropriate code to run.