Skip to content

Instantly share code, notes, and snippets.

@moaoa
Created June 10, 2020 16:49
Show Gist options
  • Save moaoa/e9dd2f8569601639770e3a6d9c319966 to your computer and use it in GitHub Desktop.
Save moaoa/e9dd2f8569601639770e3a6d9c319966 to your computer and use it in GitHub Desktop.
const express = require('express')
const app = express()
const path = require('path')
app.use(express.static('client/build'))
app.get('*', (req, res) => {
const filePath = path.join(__dirname, 'client', 'build', 'index.html')
res.sendFile(filePath)
})
app.listen(process.env.PORT || 5000, () => console.log('connected'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment