Using Express res.sendFile() Function to Serve Files

You can send files directly from the Express router using res.sendFile() method. You can send a file of any type such as HTML, PDF, Multimedia, etc. res.sendFile() Method Express provides a method in the response object of the router called sendFile() that can be used to serve static files. res.sendFile() method accepts absolute paths only. …

Using Express res.sendFile() Function to Serve Files Read More »

Send a JSON response using Express Framework

Generally, we use res.send() method to send response to the API call. Here is the sample code. const express = require(’express); const router = express.Router(); const app = express(); router.get(‘/api’, (req,res) => {     res.send(‘Hello World’); }); app.use(‘/’, router); app.listen(3000); You can send the JSON response by using res.json() method. It accepts an object …

Send a JSON response using Express Framework Read More »

Quantum Computing Explained

Quantum computing is a theory of computation based on quantum mechanics principles such as superposition and entanglement instead of classical computing principles such as a Turing machine or lambda calculus. If you are feeling like tom cruise now. via GIPHY Then I urge you to hang on to it. We will figure out what is …

Quantum Computing Explained Read More »

Build a Weather Web App Using Node Express and WeatherStack

Weather app is very common among people. It’s on our phone screen, on our computer’s menu bar. Let’s build one in order to understand how to integrate third-party APIs into our web application. In this article, we will build a simple application that will take the city name as an input and returns its current …

Build a Weather Web App Using Node Express and WeatherStack Read More »