From 0546f335fe092f2d40c8dc24e85d5de6a88b40fe Mon Sep 17 00:00:00 2001 From: Vivek Date: Thu, 30 Jun 2022 17:06:35 +0530 Subject: [PATCH] making and accessing html pages --- index.js | 16 ++++++++++++++++ public/about.html | 17 +++++++++++++++++ public/index.html | 17 +++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 index.js create mode 100644 public/about.html create mode 100644 public/index.html diff --git a/index.js b/index.js new file mode 100644 index 0000000..5041c0e --- /dev/null +++ b/index.js @@ -0,0 +1,16 @@ +const express =require('express'); +const path = require('path'); +const port =5000; + +const app = express(); +const publicPath = path.join(__dirname , 'public'); +console.log(publicPath); + +//linking all the files of public folder to be render on browser +app.use(express.static(publicPath)); + +app.listen(port , (err) => { + if(!err){ + console.log(`Server is running on the port:: ${port}` ) + } +}); diff --git a/public/about.html b/public/about.html new file mode 100644 index 0000000..4079fde --- /dev/null +++ b/public/about.html @@ -0,0 +1,17 @@ + + + + + + + About Page + + +

About Page

+ + + \ No newline at end of file diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..b15960b --- /dev/null +++ b/public/index.html @@ -0,0 +1,17 @@ + + + + + + + Index page + + +

Index page

+ + + \ No newline at end of file