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 on the local machine. For more information, see Install Funcraft.
  2. Run the fun --version command to check whether the installation is successful.

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 project or an existing project:
    cd <project-name>
  3. Run the following command to install dependencies:
    yarn install                    
  4. Run the following command to run the local project:
    yarn dev            
    run_project
    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 project to Function Compute.

    Funcraft automatically begins to deploy the project.

    Note If the .yml file cannot be added, update Funcraft to the latest version.
    deploy-app
    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 only for a limited time. To use an application in a production environment, you must bind a domain name that has been filed with Alibaba Cloud. For more information, see t1881050.html#multiTask2940.