react-render-server

0.1.5 • Public • Published

React Render Server Build Status npm version

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.

Readme

Keywords

Package Sidebar

Install

npm i react-render-server

Weekly Downloads

5

Version

0.1.5

License

MIT

Last publish

Collaborators

  • veldman