Allowing CORS for Express, React

In your Express server

const cors = require('cors')
const app = express()
app.use(cors({ origin: 'process.env.FRONTEND_URL' }))

In your React server, using ‘axios’

import axios from 'axios'

const instance = axios.create({
    baseURL: 'http://localhost:5000',
    timeout: 1000,
})

instance.post(...)