An open API service indexing awesome lists of open source software.

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

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