Site deploys fine, but backend/database data is not loading

Hey,

So my site seems to have deployed okay but my issue is the information from the database doesn’t seem to run and load in. It only works if I run the back-end locally (npm run start:backend) and then go to the site.

This is the error i’m getting in the console:
Failed to load resource: net::ERR_CONNECTION_REFUSED
localhost:8000/flights:1
TableBody.jsx:11 TypeError: Failed to fetch
at TableBody.jsx:8:5
at ri (react-dom.production.min.js:244:332)
at Ss (react-dom.production.min.js:286:111)
at react-dom.production.min.js:282:391
at S (scheduler.production.min.js:13:203)
at MessagePort.T (scheduler.production.min.js:14:128)

Website: https://eclectic-crisp-eb56cd.netlify.app/
Github: GitHub - Ketwork/flight-widget-react-mongodb

@ketz555 Checking the repository that you’ve linked to, I can see that npm run start:backend executes nodemon server.js and the server.js file starts an Express server.

You won’t be able to do this on Netlify, as it’s not how the hosting environment is intended to be used.

The static portion of your application builds via CI and deploys to CDN, and then any runtime server side functions (or API’s) that you integrate with must either be running elsewhere, or be implemented via Serverless functions.

1 Like