Node.js is a cross-platform, open-source JavaScript runtime environment that can run on Windows, Linux, Unix, macOS, and more
V8 Engine, SpiderMonkey and MacEngine
const fs = require("fs");
// the execution continues without waiting for the file writing process to complete.
fs.writeFile('file.txt', 'Hello, asynchronous!', (err) => {
if (err) {
console.error('Error writing file asynchronously:', err);
} else {
console.log('File written asynchronously.');
}
});
// The program execution halts until the file is completely written after the call
try {
fs.writeFileSync('file.txt', 'Hello, synchronous!');
console.log('File written synchronously.');
} catch (err) {
console.error('Error writing file synchronously:', err);
}An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response.
For example, when a client wants to access a secure resource, it includes an 'Authorization' header with an authentication token. The server then validates this token to grant access. In short, headers help ensure secure communication between client and server.GET: Used to request data from a specified resource. GET requests should only retrieve data and should not have any other effect on the server.
POST: Used to submit data to be processed to a specified resource. POST requests may result in the creation of a new resource or the update of an existing one on the server.
PUT: Similar to POST, but typically used for updating data on the server.
DELETE: Used to delete a specified resource from the server.
An application programming interface is a way for two or more computer programs or components to communicate with each other. It is a type of software interface, offering a service to other pieces of software.Breakdown of a typical API endpoint URL