Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thundernet8/thrift2ts-flow-demo
https://github.com/thundernet8/thrift2ts-flow-demo
browser-thrift2 demo rpc thrift thrift2ts typescript
Last synced: 30 days 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 (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-05T15:56:56.000Z (over 7 years ago)
- Last Synced: 2024-11-12T17:49:49.393Z (3 months 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.