Tencent Server Web的介绍及私有部署

官方GitHub地址

中文文档

Tencent Server Web(TSW),是一套面向WEB前端开发者,以提升问题定位效率为初衷,提供染色抓包、全息日志和异常发现的Node.js基础设施。TSW关注业务的运维监控能力,适用于http、websocket协议的业务场景,可无缝与即有应用进行整合。支持公有云、私有云和本地部署。

Examples

官方示例项目可以让大家尽快了解该项目。以下皆在树莓派中运行

  1. mkdir TSW
  2. cd TSW
  3. git clone https://github.com/Tencent/TSW.git
  4. cd examples/koa
  5. yarn
  6. yarn serve 或者 npm run serve
  7. 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);

 

后续会考虑在下面这个项目中引用

Vue2.0 + Nodejs + Nestjs + Mysql + Nginx全栈开发,项目实战(一):项目简介

猜你喜欢

转载自blog.csdn.net/wz_coming/article/details/115350066