Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Cloud Development Static website deployment how to play


May 27, 2021 A minimalist getting started manual for cloud development serverless


Table of contents


In general, we've developed html, css, js, and some media resources (such as pictures, videos) that need to be deployed to a static server. L ike what:

  • Github pages are static web services;
  • Nginx routing static pages is also the most basic static web site;
  • The product of the Vuepress project is also a static website;

So, in general, we talk about static sites, that is, sites do not have dynamic content, that is, pure HTML, no dynamic requests. C loud development also provides static site hosting (services) that can:

  • Deploy any resources and files;
  • You can set the home page of your site, such as index .html;
  • You can set up 404 pages of your site, such as 404 .html;
  • You can also customize the domain name, which is recommended, because if you are using the default domain name, access to the website will be limited;
  • Can be combined with cloud functions, cloud functions are responsible for dynamically invoking database data, static site hosting is responsible for deploying html, js, css files; f ont-weight:bold; " The dynamic website was born, and it's all Serverless."

Static site hosting requires the selection of "color:red; f ont-weight:bold; " The pay-as-you-go package can only be turned on."

Deploy static pages to host

Assuming you didn't select a pay-per-view plan earlier, you can choose to switch your environment to Pay-As-You-Go or re-create your environment, as shown in the following image:
Cloud Development Static website deployment how to play

For example, the current document site was uploaded by Vuepress, as follows:
Cloud Development Static website deployment how to play

Static site hosting provides a default domain name that can be set on the underlying configuration page for the home page and the 404 page.
Cloud Development Static website deployment how to play

Recommended paradigm: Cloud all-in-one mode

A website can not be separated from dynamic data, but also can not be separated from static pages. T herefore, it is recommended to combine the way. Here's the picture.

The first way is to access the database and cloud storage in the cloud function, as mentioned in the previous chapter, and then request the HTTP service of the cloud function through Ajax in a static hosting.

The second way is to use the SDK on the cloud development side, request services such as databases and cloud storage directly, and not write cloud functions, and the entire site is full of front-end JavaScript code.

The third approach is a combination of the first and second approaches, triggered with the cloud function HTTP at the right time, with the end-side SDK at the right time, and then partnered with static site hosting, which is the cloud-based all-in-one development model.

Cloud Development Static website deployment how to play