Check the node & npm version first by the following code:
If node & npm is already installed, then write the following command in the terminal to install express:
Now express has been installed.
Now install EJS by running the following command in the terminal:
Now create a folder with name views in the root of your project. And create home.ejs file inside the views folder.The project directory should look like the below:
Now set the default template engine by including the following line in the root index.js file of the project:
Now write simple html code in home.ejs :
<h1> Hello EJS!!</h1>
If nodemon is installed in your project then run the following command in the terminal:
Now run the project using your port number, for example:
Note: 3000 is your port number. You can replace it with your own.
The output should be :