Hosting both front-end and back-end on github pages and render respectively

Hello, quick question, I need to build a website and host it on github pages for the front-end and render for the back-end. My first question is, how does the communication takes place here? Like how does render know how to communicate with github pages to fetch my index.html? Now, normally, I'm working locally, I have 2 folder, front-end and back-end. I need to create a static route using express.static(), the problem is how should I do that to keep working into 2 separate folders keeping the folders front-end and back-end as is? I was thinking of creating a public folder inside the front-end and put whatever is found there inside. I read that github pages don't expect the index.html to be in a public folder though, it's either in the root or /docs. So was wondering what might be the right way of doing here and also if someone can explain how my hosted front-end and back-end can communicate between each other despite being on different domains etc.
7 Replies
Jochem
Jochem7d ago
github pages does not support backend code afaik
ἔρως
ἔρως7d ago
https://docs.github.com/en/pages/getting-started-with-github-pages/what-is-github-pages
GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process, and publishes a website.
Jochem
Jochem7d ago
yeah, so no backend code
ἔρως
ἔρως7d ago
yup, but a build process exists
Faker
FakerOP7d ago
no I mean from what I was told, I need to use github pages to host my front-end then I would need to use render.com to host my back-end but I'm a bit confuse how each 2 would communicate
Jochem
Jochem7d ago
Over the internet through a url
Faker
FakerOP7d ago
yeah I see, I would have to host my back-end and front-end soon will then have a better understanding what will happen, will then come back

Did you find this page helpful?