Skip to content

Instantly share code, notes, and snippets.

@faceyspacey
Last active April 3, 2018 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faceyspacey/f83aa47ec06669b653c8f840d96dbe9e to your computer and use it in GitHub Desktop.
Save faceyspacey/f83aa47ec06669b653c8f840d96dbe9e to your computer and use it in GitHub Desktop.
import express from 'express'
import routes from './routes';
import { render, build } from 'react-universal-starter';
const app = express();
const handler = build(async (req, res, clientStats) => {
try {
const html = await render({
req,
res,
routes,
clientStats
});
res.send(html);
} catch (error) {
res.json(error);
}
})
app.get('/*', handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment