0
votes

I am new to web deployment and hosting but have been coding for a couple years

I currently have a backend and frontend that work separately. I was able to deploy the frontend in Firebase and have the backend containerized (Docker) then running in Google Compute Engine (GCE) and deployed on Google App Engine (GAE) with a flex environment. Both are working independently and wonderfully; locally and in their respected deployed services but now I want to have it work under my custom domain I bought from Google Domains, let it be sicko-project.com

Locally i have my backend as local:8080/api/ping and my frontend localhost:4200/ping which gets the backend data from localhost:8080/api/ping

My question is how can I have them work under my domain?

What I know.

I know that you can't have two separate web servers under one domain, I embarrassingly learned that by chatting with Google support chat as well as common sense. Tunnel vision is great!

I know that I can have both in different subdomains: frontend on www.app.sicko-project.com and www.api.sicko-project.com

How can I have my website be www.sicko-project.com/ping similar to how i use it locally.

Thanks

Also I am using MongoDB for the database

EDIT: I got thinking will i have to redirect traffic in code to sicko-project.com and get my backend and frontend talk by:

--pseudo-ish code--

backend code having somethinglike group(app.sicko-project.com/api/ping) and frontend code have get(api.sicko-project.com/api/ping)

EDIT2: add some cors middleware

1

1 Answers

1
votes

You can configure both services under the same domain using sub domains.

this means you can have app.sicko-project.com or even the naked domain sicko-project.com for the front end and api.sicko-project.com for the back end.

To configure the front end in Firebase to the custom domain you can follow This Guide which has the following steps:

  • Add the domain
    • here enter the wizard to connect a domain, and follow it.
    • This will require a validation process which takes some time
  • Verify domain ownership
    • On your registrar go to the DNS management page
    • Add a new record
    • Wait for it to be propagated

For the Back End in App Engine you can follow This Guide which explains the following steps:

  • Verify Ownership of the domain here
  • Go to App Engine >> Settings >> Custom Domain
  • Select Add Custom Domain
  • Select the one you want to use
  • Point it to the service you want
  • Update your DNS Records with the CNAME registry you get.