Tencent Server Web(TSW),是一套面向WEB前端开发者,以提升问题定位效率为初衷,提供染色抓包、全息日志和异常发现的Node.js基础设施。TSW关注业务的运维监控能力,适用于http、websocket协议的业务场景,可无缝与即有应用进行整合。支持公有云、私有云和本地部署。
Examples
官方示例项目可以让大家尽快了解该项目。以下皆在树莓派中运行
mkdir TSW
- cd TSW
git clone
https://github.com/Tencent/TSW.gitcd examples/koa
yarn
yarn serve
或者npm run serve
curl -v localhost:4443/path/to/foo -X POST -d "hello, server"
examples/koa/index.js
const Koa = require("koa");
const axios = require("axios");
const app = new Koa();
app.use(async ctx => {
await axios.get(
"http://jsonplaceholder.typicode.com/todos/1"
).then(res => {
console.log(res.data);
});
await axios.post("http://jsonplaceholder.typicode.com/posts", {
body: JSON.stringify({
title: 'foo',
body: 'bar',
userId: 1
}),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
}).then(res => {
console.log(res.data);
});
ctx.body = "Hello, tsw 2.0";
ctx.status = 200;
}).listen(4443);
后续会考虑在下面这个项目中引用