My team is working on a project, and someone decided to use CRA for the front-end (which I am not a fan of). I'm new to CRA, so I build the application using the instructions, word for word. Then I deploy it on a Node/Express application, just like the example given in the "Deployment section". I've copied over my 'build' folder into the root directory of my project folder. I'm using a router to serve the CRA, my code looks like this:
const express = require("express");
const path = require("path");
const router = express.Router();
router.use('/mystatic', express.static(path.join(__dirname, '..','build')));
module.exports = router;
I've also tried, as an alernative:
router.get("/mystatic/*", (req, res) => {
res.sendFile(path.join(__dirname, '..', 'build', 'index.html'));
})
The application itself is running on PORT 3001. In both cases, when I go to localhost:3001/mystatic/, I get a blank page. I check the console for errors, and I find a 404 Not Found error. I take a look through my resources, and find that, funny enough, the not found file is right there:

I'm sitting there yelling, "It's RIGHT there!", but to no avail. What am I missing? This doesn't happen when I build a regular React application (NOT using create-react-app) with Webpack, so I can only conclude this error is caused by CRA and the way it configured its Webpack. Is there anyway I can take an application made with CRA, and just bundle/build it with my own Webpack configuration?
My team is working on a project, and someone decided to use CRA for the front-end (which I am not a fan of). I'm new to CRA, so I build the application using the instructions, word for word. Then I deploy it on a Node/Express application, just like the example given in the "Deployment section". I've copied over my 'build' folder into the root directory of my project folder. I'm using a router to serve the CRA, my code looks like this:
I've also tried, as an alernative:
The application itself is running on PORT 3001. In both cases, when I go to localhost:3001/mystatic/, I get a blank page. I check the console for errors, and I find a 404 Not Found error. I take a look through my resources, and find that, funny enough, the not found file is right there:
I'm sitting there yelling, "It's RIGHT there!", but to no avail. What am I missing? This doesn't happen when I build a regular React application (NOT using create-react-app) with Webpack, so I can only conclude this error is caused by CRA and the way it configured its Webpack. Is there anyway I can take an application made with CRA, and just bundle/build it with my own Webpack configuration?