Wiltech Blog
Welcome to Wiltech's code space, where we learn what we love and love what we learn!
Software Development | The latest technology trends | Tutorials & more
Getting started with node.js
March 13, 2023
Richard Wilson
Do you want to learn Node.js and aren't sure how to get started. Maybe you've already started and feeling overwhelmed by the massive amount of information out there. This post will help you figure what you need to prioritize in order to get a job as Node.js developer.
Coding
Beginner
Nodejs
In the following "hello world" example, many connections can be handled concurrently. Upon each connection, the callback is fired, but if there is no work to be done, Node.js will sleep.
const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });