https://github.com/ymichael/react-thrift
A simple Thrift service for prerendering React Components on the server-side using nodejs
https://github.com/ymichael/react-thrift
Last synced: over 1 year ago
JSON representation
A simple Thrift service for prerendering React Components on the server-side using nodejs
- Host: GitHub
- URL: https://github.com/ymichael/react-thrift
- Owner: ymichael
- License: mit
- Created: 2015-05-13T12:53:28.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-13T12:58:41.000Z (about 11 years ago)
- Last Synced: 2025-01-11T04:41:11.419Z (over 1 year ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Thrift
A simple [Thrift](https://thrift.apache.org/) service that enables prerendering
of React Components on the server-side using nodejs.
```thrift
service ReactThrift {
// Given a React component's name and its props, returns the html rendered.
string renderComponentToString(1:string name, 2:string props)
throws (1:ServerException err),
}
```
## Usage
- Register React components and start server.
```js
var s = new Server();
s.registerComponent("Component1", Component1);
s.registerComponent("Component2", Component2);
s.registerComponent("BuggyComponent", BuggyComponent);
s.listen(9090);
```
- Use whatever server-side language to make RPC to said server.
## Credits
- Inspiration from https://github.com/mhart/react-server-example