Node.JS
Node.JS 是运行在服务端的JavaScript。
下面是一个小栗子:
const http = require('http');
http.createServer(function(req,res){
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: text/plain
res.writeHead(200, {
'Content-Type': 'text/plain'});
// 发送响应数据 "Hello World"
res.end('hello world');
}).listen(3000);
console.log('localhost:3000');
运行服务:
一个简单的服务就写好了: