一、安装nodejs

下载:https://nodejs.org/en/download/

Nodejs入门编写hello world

二、编写 helloworld.js

//创建web服务器
var http=require('http');
http.createServer(function(request,response){
	const body = 'hello world';
	response.writeHead(200, {
	  'Content-Type': 'text/plain' });
	response.end('hello world');  
}).listen(8888);

三、启动web服务

node helloworld.js

Nodejs入门编写hello world

Nodejs入门编写hello world 

相关文章: