Skip to content

veldman/react-render-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Render Server

Build Status Codecov npm version npm npm PRs Welcome

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published