Express static files not being saved on all routes

Having completed my project, now when it comes to deployment, I’m having issues serving CRA’s build folder.

// server.ts

const app = express();
app.use(express.static(path.join(__dirname, 'pathToBuild')));
// ...

This files bundles all of the Routers inside of one, resulting in the one being used inside of server.ts.

// routes.ts

const router = Router();
router.use("/users", usersRouter);
router.use("/auth", authRouter);
router.use("/*", (req, res) => {

Example of the /users router:

// usersRouter.ts

const router = Router();


The only routes that are getting served the static files are:

  • /
  • /*

I’m thinking it’s something about the index Router wrapping other Routers. That’s all I can think of at the moment.