// app.js
app.get('/', (req, res) => {
const data = {
title: 'Express and EJS Tutorial',
message: 'Welcome to the Express and EJS tutorial!',
};
res.render('index', data);
});
<!-- views/index.ejs -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= title %></title>
</head>
<body>
<h1><%= title %></h1>
<p><%= message %></p>
</body>
</html>