31 lines
843 B
JavaScript
31 lines
843 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
const app = express();
|
|
const PORT = 3000;
|
|
|
|
// Serve static files from 'public' folder
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
|
|
app.get('/', (req, res) => {
|
|
res.send(`
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Dockerized Node.js App</title>
|
|
<link rel="stylesheet" href="/style.css" />
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Hello from Dockerized Node.js App!</h1>
|
|
<p>If you see this, everything is working correctly 🎉</p>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
`);
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Server running at http://localhost:${PORT}`);
|
|
}); |