Overview
Cloud Hosting supports a variety of deployment methods. You can deploy applications using application template, container image, Git repository, or cli. Regardless of which method you choose, Cloud Hosting provides you with a complete application runtime environment.
If you need to learn how to manually deploy a Cloud Hosting service from source code from scratch, please choose the appropriate Quick Start document based on your needs:
After the service is deployed, you can directly access the service via the HTTP domain on various clients, or access interface data via the SDK.
For example, you can access the cloud hosting service via the built-in SDK in WeChat Mini Programs. This avoids public network access and enables direct access to the cloud hosting service through the internal network.
// Make sure that wx.cloud.init has been called in onLaunch to initialize the environment (any environment ID is acceptable, and an empty string can be passed)
const res = await wx.cloud.callContainer({
config: {
env: "Fill in the cloud environment ID", // The environment ID for WeChat Cloud Run
},
path: "/xxx", // Enter the custom business path and parameters. The root directory is /
method: "POST", // Choose the corresponding method based on your business development
header: {
"X-WX-SERVICE": "xxx", // Enter the service name (WeChat Cloud Run - Service Management - Service List - Service Name)
// Other header parameters
},
// dataType:'text', // By default, the response is parsed as JSON. Use 'text' if you do not want the SDK to parse it automatically.
// Other parameters are the same as wx.request
});
console.log(res);
The following are some common access methods: