1const http = require('http');
2
3const hostname = '127.0.0.1';
4const port = 3000;
5
6const server = http.createServer((req, res) => {
7 res.statusCode = 200;
8 res.setHeader('Content-Type', 'text/plain');
9 res.end('Hello World');
10});
11
12server.listen(port, hostname, () => {
13 console.log(`Server running at http://${hostname}:${port}/`);
14});
1const express = require('express')
2const app = express()
3const port = 3000
4
5app.get('/', (req, res) => res.send('Hello World!'))
6
7app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
1console.log('Hello, world');// You can use apostrophes, quotation marks or tildees which are `s