Courses Lessons Contact
Courses Lessons Contact
Signup to watch this video
It's totally Free
Already have an account?

Build Create React App for production and serve it

06:21 · April 2, 2018 ·

In this video we'll learn how to prepare Create React App for production and serve it via Static or Dynamic server.

Lesson from free course Learn React by building a web app

Click show more to see Node and Express server example


const express = require('express');
const app = express();

app.use(express.static('build'));

app.get('*', (req, res) => {
  res.sendFile(__dirname + '/build/index.html');
});

const port = process.env.PORT || 9000;

app.listen(port, () => {
  console.log('server listening on port: ', port);
});


show more
  • React
Comments