nodejs学习笔记一
1、创建一个http web服务器,并返回Hello World!
const http = require('http'); http.createServer( (request, response) => { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello World\n'); }).listen(8888); console.log('Server running at http://127.0.0.1:8888/');
2、启动服务器,在浏览器中输入http://127.0.0.1:8888/,页面显示Hello World。
$ node example.js Server running at http://127.0.0.1:8888/