https://github.com/thundernet8/thrift2ts-flow-demo
https://github.com/thundernet8/thrift2ts-flow-demo
browser-thrift2 demo rpc thrift thrift2ts typescript
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/thundernet8/thrift2ts-flow-demo
- Owner: thundernet8
- License: gpl-3.0
- Created: 2017-07-04T15:00:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-05T15:56:56.000Z (almost 9 years ago)
- Last Synced: 2025-03-01T04:24:55.272Z (over 1 year ago)
- Topics: browser-thrift2, demo, rpc, thrift, thrift2ts, typescript
- Language: TypeScript
- Size: 251 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Thrift2TS-Flow-Demo
This is a demo using [thrift2ts](https://www.npmjs.com/package/thrift2ts) as thrift clients generation tool, and [Browser-Thrift](https://www.npmjs.com/package/browser-thrift2) for data transport protocol when communicate with a thrift RPC server.
## Steps
#### Write thrift
We have a tutorial.thrift file under the root of this package now
#### Generate RPC clients and typescript interfaces for app refer
```
yarn global add thrift2ts
```
or
```
npm install thrift2ts -g
```
now run cli
```
t2t -i tutorial.thrift -o RPC-client1 -c -r ../RequestSample/request1
```
again for another copy code
```
t2t -i tutorial.thrift -o RPC-client2 -c -r ../RequestSample/request2
```
request1 file is using WebSocket, request2 file is using XHR.
build scripts for demo page
```
npm run build
```
#### Run RPC Server
```
npm run server
```
#### Run Demo Web Page
```
npm run page
```
Visit localhost:8080 and follow the directions, check Chrome Dev Tool network tab to find more information.