This commit is contained in:
Anuj Sahu 2026-03-23 13:15:58 +05:30
parent e05e0a6a57
commit eeb272eabb
4 changed files with 38 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
npm-debug.log

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM node:20-alpine
WORKDIR /app
COPY package.json ./
COPY app.js ./
EXPOSE 8080
CMD ["node", "app.js"]

17
app.js Normal file
View File

@ -0,0 +1,17 @@
const http = require('http');
const PORT = 8080;
const server = http.createServer((req, res) => {
if (req.method === 'GET' && req.url === '/') {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('7thhh updateee Hello World');
} else {
res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('Not Found');
}
});
server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});

9
package.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "hello-world-app",
"version": "1.0.0",
"description": "Simple Node.js Hello World app",
"main": "app.js",
"scripts": {
"start": "node app.js"
}
}