From ccbca19cc95dd37a0d11b907e1308487ff770895 Mon Sep 17 00:00:00 2001 From: Navin-nash <1923014@saec.ac.in> Date: Sat, 12 Oct 2024 21:58:50 +0530 Subject: [PATCH] Done --- app.js | 32 ++++++++++++++++++++++++++++++++ package.json | 15 +++++++++++++++ public/styles.css | 41 +++++++++++++++++++++++++++++++++++++++++ views/about.html | 27 +++++++++++++++++++++++++++ views/gallery.html | 32 ++++++++++++++++++++++++++++++++ views/index.html | 27 +++++++++++++++++++++++++++ views/works.html | 27 +++++++++++++++++++++++++++ 7 files changed, 201 insertions(+) create mode 100644 package.json create mode 100644 public/styles.css create mode 100644 views/about.html create mode 100644 views/gallery.html create mode 100644 views/index.html create mode 100644 views/works.html diff --git a/app.js b/app.js index e69de29..9a5f8fc 100644 --- a/app.js +++ b/app.js @@ -0,0 +1,32 @@ +// app.js + +const express = require('express'); +const path = require('path'); + +const app = express(); +const PORT = process.env.PORT || 3000; + +// Serve static files from the public directory +app.use(express.static(path.join(__dirname, 'public'))); + +// Set up routes +app.get('/', (req, res) => { + res.sendFile(path.join(__dirname, 'views', 'index.html')); +}); + +app.get('/about', (req, res) => { + res.sendFile(path.join(__dirname, 'views', 'about.html')); +}); + +app.get('/works', (req, res) => { + res.sendFile(path.join(__dirname, 'views', 'works.html')); +}); + +app.get('/gallery', (req, res) => { + res.sendFile(path.join(__dirname, 'views', 'gallery.html')); +}); + +// Start the server +app.listen(PORT, () => { + console.log(`Server is running on http://localhost:${PORT}`); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..b28b452 --- /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.21.1" + } +} diff --git a/public/styles.css b/public/styles.css new file mode 100644 index 0000000..eda3e3b --- /dev/null +++ b/public/styles.css @@ -0,0 +1,41 @@ +/* public/styles.css */ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; +} + +header { + background-color: #4CAF50; + color: white; + padding: 15px; +} + +nav ul { + list-style-type: none; + padding: 0; +} + +nav ul li { + display: inline; + margin-right: 15px; +} + +nav ul li a { + color: white; + text-decoration: none; +} + +main { + padding: 20px; +} + +.gallery { + display: flex; + flex-wrap: wrap; +} + +.gallery img { + width: 200px; + margin: 10px; +} diff --git a/views/about.html b/views/about.html new file mode 100644 index 0000000..14ac78e --- /dev/null +++ b/views/about.html @@ -0,0 +1,27 @@ + + + + + + + + About + + +
+

About Me

+ +
+
+

My Background

+

Here is some information about me...

+
+ + diff --git a/views/gallery.html b/views/gallery.html new file mode 100644 index 0000000..d1096e2 --- /dev/null +++ b/views/gallery.html @@ -0,0 +1,32 @@ + + + + + + + + Photo Gallery + + +
+

Photo Gallery

+ +
+
+

Gallery

+

Here are some pictures...

+ +
+ + diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..7e89c2b --- /dev/null +++ b/views/index.html @@ -0,0 +1,27 @@ + + + + + + + + Home + + +
+

Welcome to My Website

+ +
+
+

Welcome!

+

This website showcases some of my work. Feel free to explore!

+
+ + diff --git a/views/works.html b/views/works.html new file mode 100644 index 0000000..44449bb --- /dev/null +++ b/views/works.html @@ -0,0 +1,27 @@ + + + + + + + + Works + + +
+

My Works

+ +
+
+

Projects

+

Here are some of my projects...

+
+ +