Open the VS code( Visual Studio Code) and open a black folder where you want to store your files.
Open the terminal. First, we need to install Express.js. Make sure you have already installed the node.js in your PC.
To install the express.js type
npm install express.js --save
in the terminal.
- After successful installation, the response should something like this.
- create a new file
index.js
- Now copy-paste the code given below.
const express=require("express");
const app =express();
app.get("/",function(re,res){
res.send("welcome to the page. This is a post on Hive blockchain")
})
app.listen(8000,function(req,res){
console.log("server is running");
});
- After running the above script the server should be running on 8000 port and a message will be appear on the terminal which is
server is running
- Now open your browser and search
http://localhost:8000/
- As you can see our server is responding. We can also change the text size by adding
<h1>
- Stop the server and run again to apply the changes.
