What is the correct way to create a simple HTTP server in Node.js that responds with 'Hello World'?
-
A
http.createServer((req, res) => { res.send('Hello World'); }).listen(3000);
-
B
http.createServer((req, res) => { res.writeHead(200); res.end('Hello World'); }).listen(3000);
-
C
http.newServer().on('request', () => 'Hello World').listen(3000);
-
D
http.listen(3000, (req, res) => res.write('Hello World'));