node study notes 1 (http module)

Write a service using node;

1, the establishment of a server.js file

http the require = const ( 'http');    // introduced http module 

const Server = http.createServer ((Request, Response) => {   // Create a service 
  console.log ( 'Open Service' ); 
  Response.Write ( ' Success' ); 
  Response.End (); 
}) 
server.listen ( 8080) // snooping binding port 8080

2, performing the above command code with the node

  server.js the Node
3, point your browser to http: // localhost: 8080 /
  

Guess you like

Origin www.cnblogs.com/PrayLs/p/12566185.html