Skip to content

Instantly share code, notes, and snippets.

@hyperh
Created December 5, 2016 02:45
Show Gist options
  • Save hyperh/e75332b966817c705372072fe1816f33 to your computer and use it in GitHub Desktop.
Save hyperh/e75332b966817c705372072fe1816f33 to your computer and use it in GitHub Desktop.
import express from 'express';
import React from 'react';
import { renderToString } from 'react-dom/server';
import App from '../app/components/App';
import template from '../app/template';
const app = express();
app.get('/', (req, res) => {
const appString = renderToString(<App />);
res.send(template({
body: appString,
title: 'FROM THE SERVER'
}));
});
const port = 3000;
app.listen(port);
console.log(`Listening on port ${port}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment