Node.js

Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. JavaScript is used primarily for client-side scripting, in which scripts written in JavaScript are embedded in a webpage’s HTML and run client-side by a JavaScript engine in the user’s web browser. wiki

  1. Getting started with Node.js

Getting started with Node.js

  1. Install Node.js
  2. How do I start with Node.js after I installed it?
    • create a file name app.js, and paste the following code:
     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\n');
     });
    
     server.listen(port, hostname, () => {
         console.log(`Server running at http://${hostname}:${port}/`);
     });
    
     $ node app.js
    
  3. Documents

© 2018. All rights reserved.

Powered by Hydejack v8.4.0