18 lines
433 B
JavaScript
18 lines
433 B
JavaScript
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('4th 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}`);
|
|
});
|