在网络上部署前端和后端代码

Deploy front end and backend code on the web

我申请了实习。前端使用普通 html、css、jquery、bootstrap(无框架)制作。后端使用 node.js 制作,数据库使用 mongodb.

我的项目结构是

现在,我想将此应用程序部署到网络上,使其以与在本地工作的方式相同的方式工作。我的前端目前向 node.js 服务器发出 ajax 请求。

如何部署这样的应用程序?托管也应该是免费的。我知道一些方法,例如在前端使用 Netlify 或 Github Pages,在后端使用 heroku,但不知道详细方法。帮助将不胜感激。

Netlify 让这个过程变得简单。如果您的项目在 Git 存储库中,您可以配置 continuous deployment.

Each time you push to your Git provider, Netlify runs a build with your tool of choice and deploys the result to our powerful CDN.

简而言之...

  1. 登录于https://app.netlify.com
  2. 单击来自Git的新站点。
  3. Select Git 供应商。
  4. Select 一个仓库。
  5. 配置您的构建。

这是一个 2-minute video 演练。