Updated on 2023-11-22 GMT+08:00

Quick Start

This guide is designed to help you get started as quickly as possible.

Initial Setup

There are a few prerequisites you need to install and configure:

If you already have these prerequisites set up, you can skip ahead to deploy an example service.

Installing Node.js and NPM

  1. Install Node.js and NPM. For details about the download address, see the download description.
  2. At the end, you can run node -v from your command line and you will get a result like this:

    $ node -v
    vx.x.x
    You can also run npm -v from your command line and you will get a result like this:
    $ npm -v
    x.x.x

Installing the Open-source CLI of the Serverless Framework.

  1. Run this command in your terminal:

    npm install -g serverless

  2. After the installation is complete, you can run serverless -v from your command line and you will get a result like this:

    $ serverless -v
    x.x.x

Creating and Deploying a Serverless Service

The setup is completed, now you can create and deploy a serverless service.

  1. Create a new service.

    1. Create a new service with the huawei-nodejs template.
      serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --path my-service
    2. Install the dependencies.
      cd my-service
      npm install

  2. Set up the credentials. For details, see credential settings.
  3. Update the serverless.yml.

    Update the region and credentials in serverless.yml.

  4. Deploy.

    Use this command to deploy a service for the first time or to deploy all changes in the service after modifying the functions, events, or resources in the serverless.yml file. For details about this command, see Deploy.
    serverless deploy