简体   繁体   中英

Angular2 frontend Spring Boot backend on Google cloud platform

I have an Angular2 front-end and a Java Spring Boot back-end with my REST endpoints.

Now I want to deploy this app to Google cloud platform, but I want to keep my projects separate.

All I've read is about deploying one single application, but I want to keep my front-end and back-end separate.

How can I deploy my separate projects to Google cloud platform and have them communicate here as well?

Thanks for your help!

The easiest way to do this in GCP would be to host the frontend in Cloud Storage and set up your backend in Google Compute Engine (GCE) or App Engine.

Frontend

Cloud Storage provides static hosting capabilities. You can upload your frontend files to a Cloud Storage bucket and configure your domain to serve content from that bucket. Here is a tutorial for setting a bucket up for static hosting.

Once your backend REST endpoints are set up, the frontend app can easily communicate with them using Angular's AJAX capabilities.

Backend

If you prefer direct access to the machine your server runs on, you can upload the backend code to a GCE instance and run the server there. Otherwise, I would recommend deploying the server using App Engine, which will manage the instances for you.

One point you might be interested in is configuring permssions for your backend endpoints. If you want to restrict access to those endpoints and only allow your frontend to communicate with them, try out the Google VPC firewall features.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM