This topic describes how to deploy Express applications to Function Compute. Compared with traditional deployment methods, you can deploy traditional Express applications to remote sites for direct production with one click. In addition, you can also enjoy features such as auto scaling, pay-as-you-go, and maintenance-free.
Express is a simple and flexible Web application development framework based on the Node.js platform. It provides a series of powerful characteristics to help you create a variety of Web and mobile device applications.
Step 1: Prepare the environment
You do not need to install Docker but only Funcraft. The easiest way to install Funcraft is to download the executable binary files.
Step 2: Deploy an application
- Use the following command to create an Express project.
- Use the following command to enter the sample project you created or an existing project.
- Use the following command to install local dependencies.
- Run the command to run the project.
- MacOS and Linux
DEBUG=myapp:* npm start
set DEBUG=myapp:* & npm start
- MacOS and Linux
- Run the
fun deploy -ycommand to deploy the application to Function Compute.
Funcraft automatically begins to deploy the application.
$fun deploy -y current folder is not a fun project. Generating /Users/txd123/Desktop/Express/bootstrap... Generating template.yml... Generate Fun project successfully! ========= Fun will use 'fun deploy' to deploy your application to Function Compute! ========= using region: cn-qingdao using accountId: ***********3743 using accessKeyId: ***********Ptgk using timeout: 60 Collecting your services information, in order to caculate devlopment changes... Resources Changes(Beta version! Only FC resources changes will be displayed): ... ... ... ... trigger httpTrigger deploy success function Express deploy success service Express deploy success Detect 'DomainName:Auto' of custom domain 'Domain' Request a new temporary domain ... The assigned temporary domain is 15795585-XXX.test.functioncompute.com，expired at 2020-04-12 10:46:25, limited by 1000 per day. Waiting for custom domain Domain to be deployed... custom domain Domain deploy success
After the application is deployed, you can check the logs to find the temporary domain name that Function Compute generated. You can use this temporary domain name to access the deployed application.Note The temporary domain name is used only for demonstration and development purposes. It is valid for a limited period of time. To use an application in a production environment, you must bind the application to a domain name that has obtained an Internet Content Provider (ICP) filing from Alibaba Cloud. For more information, see Bind a custom domain name.