From b63b4d71081214e87af7457728782ae19546617c Mon Sep 17 00:00:00 2001 From: Abdul Ahad <115078116+alwaysahad@users.noreply.github.com> Date: Thu, 18 Jan 2024 23:07:10 +0530 Subject: [PATCH] done --- app.js | 34 ++++++++++++++++++++++++++ package.json | 15 ++++++++++++ public/stylesheets/about.css | 46 ++++++++++++++++++++++++++++++++++++ public/stylesheets/home.css | 46 ++++++++++++++++++++++++++++++++++++ public/stylesheets/works.css | 46 ++++++++++++++++++++++++++++++++++++ views/about.html | 36 ++++++++++++++++++++++++++++ views/home.html | 35 +++++++++++++++++++++++++++ views/works.html | 37 +++++++++++++++++++++++++++++ 8 files changed, 295 insertions(+) create mode 100644 package.json create mode 100644 public/stylesheets/about.css create mode 100644 public/stylesheets/home.css create mode 100644 public/stylesheets/works.css create mode 100644 views/about.html create mode 100644 views/home.html create mode 100644 views/works.html diff --git a/app.js b/app.js index e69de29..67e1552 100644 --- a/app.js +++ b/app.js @@ -0,0 +1,34 @@ +const express = require("express"); + +const app = express(); +app.use(express.static("public")); + +app.get("/", (req, res) => { + res.setHeader("Content-Type", "text/html"); + res.sendFile(__dirname + "/views/home.html"); +}); + +app.get("/about", (req, res) => { + res.setHeader("Content-Type", "text/html"); + res.sendFile(__dirname + "/views/about.html"); +}); + +app.get("/works", (req, res) => { + res.setHeader("Content-Type", "text/html"); + res.sendFile(__dirname + "/views/works.html"); +}); + +// Set the MIME type for CSS files +app.get("/public/stylesheets/*.css", (req, res) => { + console.log(req.url); + res.setHeader("Content-Type", "text/css"); + res.sendFile(__dirname + req.url); +}); + +app + .listen(3000, () => { + console.log("Example app listening on port 3000!"); + }) + .on("error", (err) => { + console.log(err); + }); diff --git a/package.json b/package.json new file mode 100644 index 0000000..a54d916 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "lab-express-basic", + "version": "1.0.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "express": "^4.18.2" + } +} diff --git a/public/stylesheets/about.css b/public/stylesheets/about.css new file mode 100644 index 0000000..4beeaa9 --- /dev/null +++ b/public/stylesheets/about.css @@ -0,0 +1,46 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: "Roboto", sans-serif; + color: yellowgreen; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + gap: 2rem; +} + +h1 { + font-size: 3rem; +} + +h2 { + font-size: 2rem; +} + +h3 { + font-size: 1.5rem; +} + +a { + text-decoration: none; + color: yellowgreen; +} + +nav { + display: flex; + gap: 1rem; +} + +nav a { + font-size: 1.5rem; +} + +nav a:hover { + text-decoration: underline; +} diff --git a/public/stylesheets/home.css b/public/stylesheets/home.css new file mode 100644 index 0000000..8a802ad --- /dev/null +++ b/public/stylesheets/home.css @@ -0,0 +1,46 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: "Roboto", sans-serif; + color: royalblue; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + gap: 2rem; +} + +h1 { + font-size: 3rem; +} + +h2 { + font-size: 2rem; +} + +h3 { + font-size: 1.5rem; +} + +a { + text-decoration: none; + color: royalblue; +} + +nav { + display: flex; + gap: 1rem; +} + +nav a { + font-size: 1.5rem; +} + +nav a:hover { + text-decoration: underline; +} diff --git a/public/stylesheets/works.css b/public/stylesheets/works.css new file mode 100644 index 0000000..e583373 --- /dev/null +++ b/public/stylesheets/works.css @@ -0,0 +1,46 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: "Roboto", sans-serif; + color: salmon; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + gap: 2rem; +} + +h1 { + font-size: 3rem; +} + +h2 { + font-size: 2rem; +} + +h3 { + font-size: 1.5rem; +} + +a { + text-decoration: none; + color: salmon; +} + +nav { + display: flex; + gap: 1rem; +} + +nav a { + font-size: 1.5rem; +} + +nav a:hover { + text-decoration: underline; +} diff --git a/views/about.html b/views/about.html new file mode 100644 index 0000000..308683d --- /dev/null +++ b/views/about.html @@ -0,0 +1,36 @@ + + + + + + About page + + + + +

About Page

+ +

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam + perspiciatis, quae, quidem, quos quibusdam quas quod quia quas quidem. +

+ +

Skills

+ + +

Contact

+ + + diff --git a/views/home.html b/views/home.html new file mode 100644 index 0000000..509e047 --- /dev/null +++ b/views/home.html @@ -0,0 +1,35 @@ + + + + + + Home page + + + + +

Home Page

+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam + perspiciatis, quae, quidem, quos quibusdam quas quod quia quas quidem. +

+ +

Skills

+ + +

Contact

+ + + diff --git a/views/works.html b/views/works.html new file mode 100644 index 0000000..515d9a2 --- /dev/null +++ b/views/works.html @@ -0,0 +1,37 @@ + + + + + + Works Page + + + + +

Works Page

+ +

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam + perspiciatis, quae, quidem, quos quibusdam quas quod quia quas quidem. +

+ +

Skills

+ + +

Contact

+ + + +