diff --git a/app.js b/app.js index e69de29..0d0ca7d 100644 --- a/app.js +++ b/app.js @@ -0,0 +1,14 @@ +const express = require('express'); +const app = express(); +const path = require('path'); + +app.use(express.static(path.join(__dirname, 'public'))); // Serve static files + +// Routes +app.get('/', (req, res) => res.sendFile(__dirname + '/views/index.html')); +app.get('/about', (req, res) => res.sendFile(__dirname + '/views/about.html')); +app.get('/works', (req, res) => res.sendFile(__dirname + '/views/works.html')); +app.get('/gallery', (req, res) => res.sendFile(__dirname + '/views/gallery.html')); + +const PORT = 3000; +app.listen(PORT, () => console.log(`Server running at http://localhost:${PORT}`)); diff --git a/package.json b/package.json new file mode 100644 index 0000000..925e6a2 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "lab-express-basic", + "version": "1.0.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/rahulankam20/lab-express-basic.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "commonjs", + "bugs": { + "url": "https://github.com/rahulankam20/lab-express-basic/issues" + }, + "homepage": "https://github.com/rahulankam20/lab-express-basic#readme", + "dependencies": { + "express": "^4.21.2" + } +} diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..68dacbc --- /dev/null +++ b/public/style.css @@ -0,0 +1,10 @@ +body { + font-family: Arial, sans-serif; + text-align: center; + background: #f4f4f4; +} +nav a { + margin: 10px; + text-decoration: none; + color: #333; +} diff --git a/views/about.html b/views/about.html new file mode 100644 index 0000000..28c9667 --- /dev/null +++ b/views/about.html @@ -0,0 +1,19 @@ + + + + + + Home + + + + +

Welcome to the Website

+

This website is about [Person’s Name].

+ + diff --git a/views/gallery.html b/views/gallery.html new file mode 100644 index 0000000..28c9667 --- /dev/null +++ b/views/gallery.html @@ -0,0 +1,19 @@ + + + + + + Home + + + + +

Welcome to the Website

+

This website is about [Person’s Name].

+ + diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..28c9667 --- /dev/null +++ b/views/index.html @@ -0,0 +1,19 @@ + + + + + + Home + + + + +

Welcome to the Website

+

This website is about [Person’s Name].

+ + diff --git a/views/works.html b/views/works.html new file mode 100644 index 0000000..28c9667 --- /dev/null +++ b/views/works.html @@ -0,0 +1,19 @@ + + + + + + Home + + + + +

Welcome to the Website

+

This website is about [Person’s Name].

+ +