If you have any query feel free to chat us!
Happy Coding! Happy Learning!
To create a view for home, follow these steps:
views
in the root directory of your project.views
folder, create a file called home.ejs
.In home.ejs
, add the following HTML code:
htmlCopy code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Home Page</title>
</head>
<body>
<h1>Welcome to the Home Page</h1>
<p>This is the home page of our website.</p>
</body>
</html>
In your Express app, set EJS as the view engine by adding the following code:
javascriptCopy code
app.set('view engine', 'ejs');
In your Express app, add a route for the home page that renders the home.ejs
view. For example:
javascriptCopy code
app.get('/', (req, res) => {
res.render('home');
});
Now, when you visit http://localhost:3000
in your browser, you should see the content of the home.ejs
view.
Comments: 2
I am not able to access videos from second class and further. I have already completed first class
When will I get my course?
Now, Your query was resolved.