Server-side JavaScript with Node.js

Node.js is an open-source JavaScript runtime environment that allows us to run JavaScript code outside of a web browser. With Node.js, we can create web servers and build server-side applications. We can also use Node.js to interact with databases, file systems, and other resources. Node.js provides a rich ecosystem of modules and packages that makes building server-side applications easier.

const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.write('Hello World!');
  res.end();
});

server.listen(8080, () => {
  console.log('Server listening on port 8080');
});