@archangel63/react-render-server
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

What is it?

It's a very simple nodejs server that render React app to HTML string.

Features

Usage example

IMPORTANT! This package requires babel-polyfill for correct work!

  1. Install package with npm i --save @archangel63/react-render-server command

  2. Create your server.js file with the following content: ` require("babel-polyfill");

    require("@archangel63/react-render-server").run(5001, { baseDir: __dirname, mode: "render" }); `

  3. Run it with node server.js

  4. Pass requests to the http://localhost:5001 with HTTP header X-LOCAL-HOST: *your api server address*

Options

Option Possible values Description
mode view, render Sets the work mode of the server. view - server will work with static files and render React to the template. Render - server will only render react app. Default: render
baseDir string Root path. Required!
pathToApp string Path to your app build. Default: *baseDir*/app/js/bundle.js
useMui boolean Adds React Material UI support. Defailt: false
useJss boolean Adds JSS support. Default: false
disableRedux boolean Removes redux support. Default: false
publicFolder string Path to public folder in case you will use this server in view mode.
pathToLog string Path to log file. Default: *baseDir*/log.txt

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @archangel63/react-render-server

Weekly Downloads

0

Version

0.2.4

License

MIT

Unpacked Size

74.2 kB

Total Files

30

Last publish

Collaborators

  • archangel63