node.js and introduce a simple example

<! DOCTYPE HTML> 
<HTML lang = "EN"> 
<head> 
    <Meta charset = "UTF-. 8"> 
    <Meta name = "the viewport" Content = "width = Device-width, Initial-Scale = 1.0"> 
    < Meta HTTP-equiv = "X--the UA-Compatible" Content = "IE = Edge"> 
    <title> Node introduction </ title> 
</ head> 
<body> 
    <h1 of> Node introduction </ h1 of> 
    <UL> 
        <Li > nodejs underlying write </ li> the C ++ language 
        <li> nodejs Javascript in the upper layer was prepared by </ li> 
        <li> nodejs take-all </ li> field at the rear front end of the field 
        <OL> 
            <Li> distal </ li > 
            <Li> GULP / WebPACK / VUE / REACT....</li>
        </ol>
        <ol>
            <li>后端</li>
            <li> the Java / PHP / Python / Go / c # / c ++ / node </ li> 
            <li> Many companies interfaces all with node write, some only a portion of the write (node - Middleware) </ li> 
        </ OL > 
    </ UL> 
    advantages: <br /> 
        performance: high (86 times the php) - java 100 --- php 60 --- node --- 30 --- python 15 <br /> 
        easy: threshold low (JS grammar), large companies with <br /> 
    drawback: <br /> 
        compatible platform <br /> less 
        and less learning resources, demanding <br /> 
         the Node os <br /> 
    environment <br /> 
        the Node < br /> 
            HTTPS: // nodejs.org/en/ <br /> 
            HTTP: // nodejs.cn/ <br /> 
        database <br />
            Relational database mysql --- --- + database table --- table <br />
            non-relational databases MongoDB --- --- --- Collection Database + {username set ---: 'wudaxun'} <br />  '} <br />
    Version description: <br /> 
        LTS version is recommended <br />
            V7.6.x Stable --- see the second number is an even number stable <br /> 
            V7.7.x unstable version <br /> 
        CURRENT latest version <br /> 
        expansion: software version number <br /> abc 
            a major version changes jquery 1 jquery 2 --- deleted ie low version compatible /> <br 
            B function point changes jQuery (the bind ON (Live)) <br /> 
            C bug small modifications /> <br 
</ body> 
</ HTML>

demo:

/ * * 
 * Name Server files 
 * File names do not use the Node 
 * 
 * servers form 
 * HTTPS protocol HTTP 
 * localhost domain www.daxunxun.com 
 * Port 0-25535 (available port) 0-1024 (the system takes) 
 * HTTP URL the default port number is 80. 
 the default port number * https is 443. 
 * server code changes, restart the server 
 * CTRL + C 
 * the Node 03server.js 
 * / 
/ * * 
 * when you install the Node 
 * the Node comes with many modules will 
 * http://nodejs.cn/api/ left menu belongs to node js own module 
 * var module name = require ( 'left menu name') 
 * / 
// 1. http module incorporated 
var http = the require ( 'http' ); 

// 2. create a server-based http module 
var= http.createServer Server ( function (Request, Response) { // 4. implement server logic 
    // Request data acquired from the interface of the distal end 
    // Response content delivery to the distal end 
    Response.Write ( 'Hello World !!!!' ) 
    Response.End () // indicating the end of this request, if not, would have been in a loaded state - and only one, can only use it at the last 
}) 

// 3. listening port 3,000,420,080,808,081 this server 8085 
server.listen (3000)

 

Guess you like

Origin www.cnblogs.com/hy96/p/11584119.html