crm-api-template-generator/frontend/server.js

19 lines
444 B
JavaScript
Raw Permalink Normal View History

const express =require('express')
const path = require('path')
require('dotenv').config()
const app = express()
const PORT = process.env.REACT_APP_PORT || 6003
console.log('FRONTEND PORT: ', PORT)
app.use(express.static(path.join(process.cwd(), 'build')))
app.get('*', (req, res) => {
res.sendFile(path.join(process.cwd(), 'build', 'index.html'))
})
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`)
})