Photo by Dima Solomin on Unsplash
Clone Netflix "Hello World" app using Node-Express
Know more about Netflix's secret page
Let's get started right away
New node app
Initiate a new node app using the following command
npm init -y
The -y option autofill necessary details in our package.json file. However the entry point would be "index.js" file. If you prefer to use some other page like app.js, you can ignore the -y option and respond to individual prompts.
Install Express
Express is an extremely popular minimal web framework and routing middleware for building server-side applications in Node.js.
So let's install
npm i express
Type : Module
In our package.json file, add a "type" key with the value of "module"
"type": "module"
Building application
It's time to start building our application. In our index.js file, follow the below steps
import express
import express from "express";
Initiate new express app instance
const app = express();
Home Page Routing
app.get("/", async (req, res) => {
await res.send("<b>Hello World!!</b>");
});
The "/" route belongs to index Page and we are sending our required response back to the browser(client).
Start Listening
app.listen(3000, () => console.log("Netflix Hello World"));
As is the norm our express app will listen for incoming requests in port 3000
Complete App
import express from "express";
const app = express();
app.get("/", async (req, res) => {
await res.send("<b>Hello World!!</b>");
});
app.listen(3000, () => console.log("Netflix Hello World"));
Screenshot
Live Netflix Link
Live Link : https://www.netflix.com/helloworld