Skip to content

hangovergames/ssr-server

Repository files navigation

@hangovergames/ssr-server

Server side rendering HTTP server for ReactJS.

It is intended to have dynamic HTML meta tag support (e.g. SEO), though that's still under development.

NOTE! It's pretty experimental and does not work as standalone yet.

Environment Variables

Variable name Description
BUILD_VERSION The version to compile in the build. Defaults to package.json version.
BUILD_NODE_ENV The build mode. Defaults to production.
BUILD_COMMAND_NAME The name for the server command in usage help. Defaults to ssr-server
BUILD_LOG_LEVEL THe log level. Defaults to INFO.

Install

npm i -g @hangovergames/ssr-server

Usage

ssr-server /path/to/frontend/build /path/to/frontend/app/App.js /path/to/frontend/app/index.js

...where arguments are:

  1. /path/to/frontend/build is the directory containing the static document root generated by create-react-app or other build system
  2. /path/to/frontend/app/App.js is the (probably compiled) App for server side rendering
  3. /path/to/frontend/app/index.js is the optional (probably also compiled) entry file for initializing the server side app (e.g. i18n, etc).

Building the source

Building is only necessary if for development.

npm run build