如何部署分离的前端和后端? [英] How to deploy separated frontend and backend?

查看:285
本文介绍了如何部署分离的前端和后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有反应/快递的新项目作为前端,并作为后端api进行环回。我已经在我的开发环境中将不同的端口分开了两个。

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

如何在生产环境中部署它们?
1)在同一台服务器上托管 - 将后端与不同的子域分开?
2)在两个不同的服务器上托管 - 似乎不可能使用相同的域

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

推荐答案

我刚刚回答 AWS的相关问题

您可以部署


  • strong>

  • 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 在GitHub页面上

  • api.domain.com 在Heroku

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

这篇关于如何部署分离的前端和后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆