note js code example
Example 1: node js
Node js allows you to run javascript outside of your browser
ex: you are able to run it on your terminal
Example 2: what is node
npm install http then write a webserver...
const http = require('http');
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, () => {
console.log(`Server running at PORT:${port}/`);
});
Example 3: node.js
When you install Node.js, you can do these things:
Make web servers
Run JavaScript without an HTML file
...and more!