Files
2026-06-23 21:31:48 +00:00

39 lines
1.0 KiB
JavaScript

const http = require('http');
const PORT = 3010;
// Create a server that sends a simple HTML page
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
// Your HTML goes right here inside the backticks
res.end(`
<!DOCTYPE html>
<html>
<head>
<title>Node App</title>
<style>
body {
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
h1 { color: #333; }
</style>
</head>
<body>
<h1>Hey, this is working!3</h1>
</body>
</html>
`);
});
// Start the server
server.listen(PORT, () => {
console.log(`Server is running! Open your browser and go to: http://localhost:${PORT}`);
});