Aug 11, 2024
http
module.const http = require('http');
http.createServer()
, which accepts a callback function to handle requests.console.log('Request made');
server.listen(port, hostname, callback)
:
server.listen(3000, 'localhost', () => { console.log('Listening on port 3000'); });
node server.js
localhost:3000
.Ctrl + C
to stop the server.http://localhost:3000
.