Node JS - Make HTML page
index3.js -
const express=require('express');
const path=require('path');
const app=express();
const publicPath=path.join(__dirname, 'public');
console.log(publicPath);
app.use(express.static(publicPath));
app.listen(5000);
--------------------------------------
index.html (under public folder)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Home Page</title>
</head>
<body>
<h1>Home Page Node JS </h1>
</body>
</html>
------------------------------------
about.html (under public folder)
<!DOCTYPE html>
<html lang="en">
<head>
<title>About Us Page</title>
</head>
<body>
<h2>About Us Page</h2>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolor fugit tenetur ex doloremque quis expedita dignissimos tempore officia! Voluptates, illum?</p>
</body>
</html>
Comments
Post a Comment