diff --git a/app.js b/app.js index e69de29..1ee708a 100644 --- a/app.js +++ b/app.js @@ -0,0 +1,24 @@ +const express = require('express'); +const path = require('path'); + +const app = express(); +const port = 4000; + +app .use(express.static(path.join(__dirname, 'public'))); + +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.listen(port, () => { + console.log(`Server is running at http://localhost:${port}`); + }); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8fddf73 --- /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.19.2" + } +} diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..7733d06 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,19 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + text-align: center; + } + + nav a { + margin: 0 15px; + text-decoration: none; + color: #007BFF; + } + + .gallery img { + width: 200px; + height: auto; + margin: 10px; + } + \ No newline at end of file diff --git a/views/about.html b/views/about.html new file mode 100644 index 0000000..f9b3dde --- /dev/null +++ b/views/about.html @@ -0,0 +1,14 @@ + + + + + + About + + + +

About Me

+

This is the about page.

+ Back to Home + + diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..e109924 --- /dev/null +++ b/views/index.html @@ -0,0 +1,17 @@ + + + + + + Home + + + +

Welcome to My Website!

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

My Works

+

Here are some of my works.

+ Back to Home + +