node.js(一)

安装node.js

node.js创建应用

新建server.js

 1 const http = require('http')
 2 
 3 http.createServer((Request, Response) => {
 4     Response.writeHead(200, {
 5         'Content-Type': 'text/plain'
 6     })
 7     Response.end('hello word')
 8 }).listen(9999)
 9 
10 console.log('Server running at http://192.168.1.113:9999/')

node执行以上代码

node server.js

打开浏览器访问,就会看到如下

原文地址:https://www.cnblogs.com/dropInInt/p/13065544.html