Backend Flashcards
Web Framework
A software framework designed to support web application development
Express
A minimalist web framework for Node.js. Express abstracts away many difficulties working directly in Node.
Node.js
Node.js brings event-driven programming to web servers, enabling development of fast web servers in JavaScript. Developers can create scalable servers without using threading, by using a simplified model of event-driven programming that uses callbacks to signal the completion of a task.
Middleware
A function that an express server runs between receiving a request and responding to that request:
const middleware = (req, res, next) => { // Middleware function body };
(req, res, next)
The req parameter stands for request. Information and methods related to the incoming request will be stored in this object.
The res parameter stands for response. This object has information and methods related to sending back a response from the server.
The next parameter, when called, will tell Express that this middleware function is complete. It will then go on to the next piece of middleware.
Route
Also called a path, the part of the URL that comes after the domain name
Query String
Text that comes at the end of a URL and provides additional information to a given route
Query Parameter
A key-value pair in a query string, used to filter the resources requested from the server. The key and the value are strings separated by an equals sign =. In the below example, the query parameter key is q and the value is javascript.
https://www.google.com/search?q=javascript
Route Parameter
A part of the URL that changes depending on the data to be displayed on the website, used to access parts of a URL by storing the value in a variable.
RESTful APIs
A web API that adheres to the constraints of REST (Representational State Transfer - a set of constraints for building web APIs).
With REST, if you have a URL, then you have a resource. Resource refers to the data returned by a request; that data can be a text file, HTML page, image, video, JSON, or something else. Every URL provides access to a resource on your server.
A RESTful API server provides access to resources. A client, like the browser or another server, can then access and change the resources.
HTTP Request Method
Also called an HTTP verb, a method that indicates the desired action (such as deleting a resource) to be taken on a given resource such as GET, POST, PUT, PATCH, and DELETE.
API Endpoint
A location where a client can send a request to retrieve a resource that exists on the server
HTTP response status code
A code sent along with every HTTP response from the server, indicating the server’s response to the client
RESTful Design Principles
URLs should include nouns, not verbs.
Use plural nouns only for consistency (no singular nouns).
Use HTTP methods (HTTP/1.1) to operate on these resources:
Use HTTP response status codes to represent the outcome of operations on resources.
Should
CRUD
//(Route name, method, description)
(Create, POST, Create a new post, assign an id, and return at least the id)
(Read, GET, return post/profile with specified id, or return 404 if it doesn’t exist)
(Update, PUT, update an existing post with the data in the request body)
(Delete, DELETE, Delete post with specified id, or return 404 if it doesn’t exist)
(List, GET, Return a list of profiles/posts)