JSPM

react-app-middleware

0.3.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q38761F
  • License MIT

Connect/Express middleware for react-app

Package Exports

  • react-app-middleware

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-app-middleware) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-app-middleware

Connext/Express server middleware to serve pre-rendered React apps.

Installation

% npm install react-app-middleware

Usage

Use react-app-controller to define your application and then construct the following middleware stack:

var express = require('express');
var ui = require('react-app-middleware');
var bundle = require('react-app-bundler');

var app = express();
app.use(ui.serveRenderedPage('./index.jsx', {
  debug: true,
  script: '/bundle.js'
}));
app.get('/bundle.js', bundle.serve('./index.jsx', {debug: true}));

app.listen(3000);

Note also that you need to ship client code to a browser, you can use react-app-bundler package for that.