This topic describes how to deploy a Nuxt.js application to Function Compute. Function Compute provides a method different from traditional deployment methods. You can deploy a traditional Nuxt.js application to Function Compute and use the application for production without performing steps such as purchasing a machine. Your Nuxt.js application can use the auto-scaling, pay-as-you-go, and O&M-free features of Function Compute.

Background information

Nuxt.js is a general-purpose application framework based on Vue.js. It abstracts away the client-server architecture and focuses on user interface rendering for applications. Nuxt.js has preset all the configurations needed to develop server-side rendered (SSR) Vue.js applications. It provides many useful features for the client-server application architecture, such as asynchronous data loading, middleware support, and layout support.

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.

  1. Install Funcraft. For more information, see Install Funcraft.
  2. Run the fun --version command to check whether the installation is successful.
  3. Configure Funcraft. For more information, see Configure Funcraft.

Step 2: Migrate the application

  1. Run the following command to create a Nuxt.js project. If you already have a Nuxt.js project, skip this step.
     npx create-nuxt-app <project-name>                        
  2. Run the following command to open the sample application or an existing application:
    cd <project-name>
  3. Run the following command to install dependencies:
    yarn install                    
  4. Run the following command to run the on-premises application:
    yarn dev            
    The following results are returned:pre-view
  5. Run the following command to compile the Nuxt.js project:
    yarn build           
  6. Run the fun deploy -y command to deploy the application to Function Compute.

    Funcraft automatically begins to deploy the application.

    Note If the .yml file cannot be added, update Funcraft to the latest version.
    After the project is deployed, check the log to find the temporary domain name that Function Compute generated. You can use this temporary domain name to access the deployed application.temporary-domain
    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.