JavaScript is a programming language that is compiled and runs within a browser's Chrome V8 engine. However, to run JavaScript outside of a browser, a runtime is required. Node JS is one such runtime that enables JavaScript to run outside of a browser. It is particularly useful for creating non-blocking and event-driven servers due to its single-threaded and asynchronous nature. Node JS is commonly used for developing websites and back-end API services.
CRUD operation
In persistent storage systems, there are four main types of operations that can be performed: create, read, update, and delete. These operations are collectively referred to as CRUD operations. They can be implemented using databases or by using the HTTP methods provided by RESTful APIs.
Create: The create operation enables users to add new records to a database. Depending on the data storage, the name of this operation may differ. Users can create a new row and fill it with data as per each attribute. However, the creation of attributes is the responsibility of the database administrator. In SQL, this operation is called INSERT and in HTTP, it is referred to as PUT.
Read: The read operation in databases is similar to a search operation, allowing users to retrieve specific data from the database by reading it. Users can read data from a database table based on specific criteria. In SQL, this operation is known as SELECT, while in HTTP, it is known as GET.
Update: The update operation is used to modify the information of users or data related to them in a database. Users can change the attribute value of a database table using this operation. In SQL, it is referred to as UPDATE, while in HTTP, it is known as PUT.
Delete: The delete operation enables users to remove specific data or their personal information from a database. Depending on the attribute, users can also remove other information. This operation is known as DELETE in SQL and HTTP. It is mostly used in user-interactive websites for CRUD operations.
JWT
JSON Web Token, commonly known as JWT, is a security mechanism that enables sharing of information between a client and a server. It is particularly useful for Authorization and Information Exchange. Each JWT contains encoded JSON objects, including a set of claims. To ensure that the claims cannot be altered after the token is issued, JWTs are signed using a cryptographic algorithm. The web structures of JWTs are well-defined.
Header: There are two parts to the token: the token type and the signing algorithm.
Payload: There are three types of claims: registered, public, and private claims. Claims are statements about an entity and additional data.
Signature: Each JWT consists of three parts: the encoded header, the encoded payload, and a signature generated by combining a secret, algorithm, and the previous two parts. It is represented as xxxxx.yyyyy.zzzzz.
Express JS
Node.js is a powerful platform designed to help developers build I/O applications that are server-side event-driven, using JavaScript. On the other hand, Express.js is a highly efficient and minimalist web framework for Node.js. It provides server-side logic for web and mobile applications, making it an essential tool for web developers.