Skip to content

Latest commit

 

History

History
224 lines (151 loc) · 6.31 KB

File metadata and controls

224 lines (151 loc) · 6.31 KB

References

Assorted reference information

Return Home

Symantic Versioning

Uses 3 numbers, seperated by a period. e.g. 1.2.4

Breaking changes . New features . Bug fixes

^ back to top ^

Express

Definitions

  • Express JS is used to handle HTTP logic
  • Express middleware is a function which runs between the request and response.
  • Express-Validators validates routes according to business rules
  • EJS is a templating engine for injecting data into View files

^ back to top ^

Express Middleware

  • Express.json(): (Built-in) Parses incoming requests with JSON payloads
  • Express.urlencoded(): (Built-in) Parses incoming requests with URL-encoded payloads
  • Express.static(): (Built-in) Serves static files
  • Morgan: HTTP request logger
  • Cors: Enables cross-origin resource sharing
  • Helmet: Secdures express apps by setting HTTP headers

^ back to top ^

HTTP Methods

Method Code Purpose
GET 200 Fetch data
POST 201 Create data
PUT 200 Update record
PATCH 204 Update partial record
DELETE 204 Deleted record
ERROR 400 Bad request
ERROR 500 Signifies server error

Examples

Code Implementation
200 Get record or record
200 Full record updated
201 Record added
202 Request received for processing, but not completed
204 Partial record update completed (No content returned)
204 Record deleted (No content returned)
206 Partial content
300 Redirect
400 Rejected API call - missing required header
401 Unauthorised request
403 Forbidden
404 Record not found
408 Request timeout
409 Rejected API call - Operation in progress
422 Rejected API call - Invalid header/data sent
500 Internal server error
503 Service / Server unavailable (e.g maintenance)

^ back to top ^

Model - View - Controller (MVC) Pattern

Can be server, client, or both.

Model : Data that is required to populate a page or control (partial)

View : The page, or partial page, which will display the information. (Often EJS)

Controller : Needed to render model data to a view, or partial. Which handles any API calls for CRUD or to external sites, and for managing any dynamic functionality on the web page.

^ back to top ^

Array Methods

arrays

^ back to top ^

API Terms

Definition

  • Enables communications between software systems
  • Defines structured rules for integration

^ back to top ^

Endpoint

  • Represents specific API functionality path
  • Unique URL for accessing resources

^ back to top ^

HTTP API Methods

  • Enable standardised CRUD operation handling
  • Define action performed on resources

^ back to top ^

Request

  • Client sends structured data payload
  • Includes headers, parameters, and body

^ back to top ^

Response

  • Server returns processed result data
  • Contains status code, and payload

^ back to top ^

Status Codes

  • Indicate outcome of API request
  • Help identify errors and success

^ back to top ^

Authentication

  • Verifies identity of requesting entity
  • Uses token keys or credentials

^ back to top ^

Parameters

  • Transfers additional data within requests
  • Support filtering, sorting, and pagination

^ back to top ^

Headers

  • Carry metadata about HTTP requests
  • Specify content type and authorisation

^ back to top ^

Authorisation

  • Determines user access permission levels
  • Enforces role-based access control (RBAC)

^ back to top ^

Rate Limiting

  • Restricts the number of allowed requests
  • Prevents abuse and server overload

^ back to top ^

API Key

  • Unique identifier for client access
  • Used for simple authentication mechanisms

^ back to top ^

JSON

  • Lightweight structured data exchange format
  • Commonly used in REST APIs

^ back to top ^

Webhook

  • Sends automated event triggered callbacks to a URL
  • Enables real-time system updates

^ back to top ^

oAuth

  • Secure delegated access authorisation framework
  • Issues tokens for controlled access

^ back to top ^