7aa932c9c2
Reviewed-on: #1
39 lines
1.0 KiB
JavaScript
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!1</h1>
|
|
</body>
|
|
</html>
|
|
`);
|
|
});
|
|
|
|
// Start the server
|
|
server.listen(PORT, () => {
|
|
console.log(`Server is running! Open your browser and go to: http://localhost:${PORT}`);
|
|
}); |