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 operations such as purchasing a server. The deployed Nuxt.js application can use the auto scaling, pay-as-you-go, and O&M-free features of Function Compute.

Prerequisites

The following operations are complete:
Notice

The content about how to use Funcraft to migrate an application from a traditional framework is no longer maintained. We recommend that you use Serverless Devs to migrate relevant frameworks to Function Compute.

For more information about how to migrate Function Compute-related resources from Funcraft to Serverless Devs, see Migrate resources from Funcraft to Serverless Devs.

For more information about how to use Serverless Devs to migrate an application from a web framework, see Use Serverless Devs to migrate web frameworks.

We apologize for any inconvenience caused.

Background information

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

Procedure

  1. Run the following command to create a Nuxt.js project.
     npx create-nuxt-app <project-name>                        
    Note If a Nuxt.js project already exists, skip this step.
  2. Open the sample project or an existing project.
    cd <project-name>
  3. Install dependencies.
    yarn install                    
  4. Run the on-premises project.
    yarn dev            
    run_project
    The following result is 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.
    Note If the template.yml file cannot be added, update Funcraft to the latest version.
    deploy-app
    After the application is deployed, you can check the logs to find the temporary domain name that is generated by Function Compute. 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. You must use a domain name that has obtained an Internet Content Provider (ICP) filing from Alibaba Cloud for production. For more information, see Configure a custom domain name.