Mysql2 messing with routing

I am trying to use mysql2 in the backend but it seems to messing with my routes when I use it in production.

My server file looks like this:

const express = require('express')
const app = express()
const PORT = process.env.PORT || 5001
const path = require('path')

const cors = require('cors')
const bodyParser = require('body-parser')

// const mysql = require('mysql2')

app.use(cors())
app.use(bodyParser.json())


app.get('/test', (req, res) => {
    res.send({message: 'Working Again'})
})

app.get('/budgettracker/pull', (req, res) => {
    res.send({message: '/budgettracker/pull hit'})
})

app.post('/budgettracker/push', (req, res) => {
    console.log(req.body)
    res.send(req.body)
})

app.get('*', (req, res) => {                       
    res.sendFile(path.resolve(__dirname, '../public_html','index.html'));                               
  });


app.listen(PORT, () => {
    console.log(`Listening on port http://localhost:${PORT}`) 
})

I am using react router to handles routes in the front end, and res.sendFile on my node server to serve index.html for unspecified routes.

When I include the “require mysql2” line, I get a 503 error when refreshing the page on child routes.
When I leave it commented out, the routing works as intended. I don’t understand what the problem is, and I have half a mind to just switch to sequelize and see if that works.

Any suggestions would be appreciated.

I tried reinstalling mysql2 on the server, but that doesn’t seem to change anything. I’m not sure if there should be a specific order when declaring the routes and database stuff.