Postman 是一款用来测试 WEB 接口的工具,可以简单的发送 GET 、POST、PUT、DELETE 等请求,可以在 chrome 商店里面搜索安装。 为了介绍它的功能,首先本地起一个服务器:
var http = require("http")
var url = require("url")
var querystring = require("querystring")
http
.createServer(function (req, res) {
res.writeHead(200, { "content-type": "text/json" })
if (req.method === "GET") {
var params = url.parse(req.url, true).query
res.write(params.name + " is " + params.age + " years old")
res.on("error"