How to deploy separated frontend and backend?

让人想犯罪 __ 提交于 2019-12-31 08:16:11

问题


I am developing a new project with react/express as the frontend and loopback as the backend api. I have separated both of them in my development environment with different ports.

How should I deploy them in production?

  1. Hosting on a same server - separate the backend with a different sub-domain?

  2. Hosting on 2 different servers - seems impossible to use back the same domain.


回答1:


I just answered a related question for AWS.

You can deploy

  • your frontend on a static hosting service and a CDN

    • AWS S3 + AWS CloudFront
    • Google Cloud Storage + Google Cloud CDN
    • GitHub Pages + CloudFlare
    • Now
    • Surge
    • Netlify
    • etc
  • your backend on a cloud computing service

    • AWS Elastic beanstalk or AWS EC2
    • Google App Engine
    • Now
    • Heroku
    • etc

You can set different subdomains on different hosts, e.g.

  • app.domain.com on GitHub Pages
  • api.domain.com on Heroku


来源:https://stackoverflow.com/questions/41247687/how-to-deploy-separated-frontend-and-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!