Build the complete Assignment 5 manual on trusted branch pushes
Assignment 5 manual PDF / manual (push) Successful in 47s
Assignment 5 manual PDF / manual (push) Successful in 47s
This commit is contained in:
parent
fa9a32f8a9
commit
c74087a93b
@@ -0,0 +1,12 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install --omit=dev
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["npm", "start"]
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "color-buttons-app",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Color Buttons App</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
text-align: center;
|
||||
margin-top: 50px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
button {
|
||||
padding: 12px 24px;
|
||||
font-size: 18px;
|
||||
margin: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Click a Button to Change Background</h1>
|
||||
<button id="blueBtn">Blue</button>
|
||||
<button id="redBtn">Red</button>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
class ColorButtonController {
|
||||
constructor(buttonId, color) {
|
||||
this.button = document.getElementById(buttonId);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
changeBackground() {
|
||||
document.body.style.backgroundColor = this.color;
|
||||
}
|
||||
|
||||
bind() {
|
||||
this.button.addEventListener("click", () => this.changeBackground());
|
||||
}
|
||||
}
|
||||
|
||||
const blueButton = new ColorButtonController("blueBtn", "blue");
|
||||
const redButton = new ColorButtonController("redBtn", "red");
|
||||
|
||||
blueButton.bind();
|
||||
redButton.bind();
|
||||
@@ -0,0 +1,14 @@
|
||||
import express from "express";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
app.use(express.static(path.join(__dirname, "public")));
|
||||
|
||||
app.listen(PORT, "0.0.0.0", () => {
|
||||
console.log(`Server running at http://0.0.0.0:${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user