0.1.5 • Published 7 years ago
react-render-server v0.1.5
React Render Server
React Render server used by Django to render JSX files server side. Works with Redux.
Requirements
Current version of node is 7.5, but should be usable by node >= 5.
Installation
To get started with React Render server you can simply install it with npm:
npm install --save react-render-server
Usage
Run the script in bin
or start with node render-server
when globally installed.
Pass a JSON encoded object to serializedProps on the body. If the props
contain storePath
it will try and import that path as the store.
This requires components that you want to render to have the "store" prop.
Send a JSON POST to /render
on the selected port with the JSON body as followed
{
"path": "/Your/Absolute/Path/To/The/Component/react.jsx",
"serializedProps": "{\"test\": \"Hello\"}"
}
or with normal props:
{
"path": "/Your/Absolute/Path/To/The/Component/react.jsx",
"props": {"test": "Hello"}
}
Redux example:
POST to /render
{
"path": "/Users/veldman/projects/django-react/render-server/lib/__mock__/react.jsx",
"serializedProps": "{\"test\": \"Hello\", \"storePath\": \"/Path/To/Store/store.js\"}"
}
Help
For all commands enter the help flag:
node render-server --help
Further info
See React Render and Python React.