Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -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}`));
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "lab-express-basic",
"version": "1.0.0",
"description": "<img src=\"https://imgur.com/XOS1Vdh.png\" width=\"150px\" height=\"150px\">",
"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"
}
}
10 changes: 10 additions & 0 deletions public/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
body {
font-family: Arial, sans-serif;
text-align: center;
background: #f4f4f4;
}
nav a {
margin: 10px;
text-decoration: none;
color: #333;
}
19 changes: 19 additions & 0 deletions views/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/works">Works</a>
<a href="/gallery">Gallery</a>
</nav>
<h1>Welcome to the Website</h1>
<p>This website is about [Person’s Name].</p>
</body>
</html>
19 changes: 19 additions & 0 deletions views/gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/works">Works</a>
<a href="/gallery">Gallery</a>
</nav>
<h1>Welcome to the Website</h1>
<p>This website is about [Person’s Name].</p>
</body>
</html>
19 changes: 19 additions & 0 deletions views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/works">Works</a>
<a href="/gallery">Gallery</a>
</nav>
<h1>Welcome to the Website</h1>
<p>This website is about [Person’s Name].</p>
</body>
</html>
19 changes: 19 additions & 0 deletions views/works.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/works">Works</a>
<a href="/gallery">Gallery</a>
</nav>
<h1>Welcome to the Website</h1>
<p>This website is about [Person’s Name].</p>
</body>
</html>