Sling Academy
Home/Node.js/Page 42

Node.js

Node.js is a JavaScript runtime that allows for server-side scripting, enabling the development of scalable network applications using a non-blocking, event-driven architecture.

How to Get a URL Parameter in Express

Updated: Dec 28, 2023
Overview Working with URL parameters is a common task for web developers. URL parameters, often known as query strings or path variables, are used to send small amounts of data from the client to the server. Express, a flexible Node.js......

How to Extract Request Body in Express JS

Updated: Dec 28, 2023
Overview Express.js is a fast, unopinionated, minimalist web framework for Node.js, which is used extensively to build back-end services or APIs. One of the fundamental tasks when processing HTTP requests is to extract the request......

How to Extract Headers in Express.js

Updated: Dec 28, 2023
Express.js is a powerful web application framework for Node.js, designed for building web applications and APIs. Among its numerous features, Express provides a straightforward way to interact with the HTTP request and response headers.......

How to Download a File from NodeJS Server using Express

Updated: Dec 28, 2023
Overview Node.js is a powerful platform for building network applications, and Express is a popular web framework for Node.js. Together, they can be used to serve and manage downloads of files of any type. In this tutorial, we’ll......

How to Create Middleware in Express.js

Updated: Dec 28, 2023
Middleware functions are an essential part of any Express.js application. They can perform tasks ranging from logging, parsing, authentication, and more. It’s crucial to understand middleware if you are to develop scalable and......

How to Create and Use Global Variables in Node.js

Updated: Dec 28, 2023
In Node.js, global variables are properties of the global object which is available in all modules throughout the application. In a Node.js environment, each module is wrapped in a function and it makes its own scope. Thus, variables......

How to Call a Python Function in a Node.js App

Updated: Dec 28, 2023
A few approaches to executing Python code in your Node.js project. 1. Using Child Process Module Solution Description: This solution involves using the built-in child_process module in Node.js to spawn a Python process and execute a......

How to Block IP Addresses in Express.js

Updated: Dec 28, 2023
Blocking specific IP addresses in your Express.js application can be crucial for security and traffic management. There are multiple methods to achieve this, each with its benefits and drawbacks. Below, we’ll explore three different......

Fixing Node.js & Express File Upload Error: req.files undefined

Updated: Dec 28, 2023
When you’re working with file uploads in Node.js and Express, encountering ‘req.files undefined‘ can be a common issue. This error typically arises because the middleware required to parse multipart/form-data, which is......

Fixing Node.js & Express Error: Request Entity Too Large

Updated: Dec 28, 2023
When developing with Node.js and Express, you might encounter an error stating ‘request entity too large’. This error occurs when a client sends a request to the server with a body payload that exceeds the maximum limit the......

Fixing Node.js & Express Error: req.body undefined

Updated: Dec 28, 2023
Encountering a req.body undefined error in Node.js with Express can be a common issue usually related to middleware configuration. The req (request) object in Express does not inherently include a body property, we have to use body-parser......

Fixing ERR_HTTP_HEADERS_SENT in Node.js and Express

Updated: Dec 28, 2023
The ERR_HTTP_HEADERS_SENT error occurs in Node.js and Express applications when an attempt is made to modify the HTTP headers of a response after they have already been sent to the client. This can happen if you’re trying to send a......