tencent cloud


API Gateway Component

Last updated: 2021-03-05 15:45:55

    Operation Scenarios

    The API Gateway component is one of the basic components in the serverless-tencent component library. Through this component, you can create, configure, and manage API gateways with speed and ease.


    Through the API Gateway component, you can perform a complete set of operations on an API service/API, such as creation, configuration, deployment, and deletion. The supported commands are as follows:


    Install Serverless through npm:

    npm install -g serverless


    Create the serverless.yml file locally:

    touch serverless.yml

    Configure serverless.yml as follows:

    # serverless.yml
    component: apigateway # Component name, which is required. `apigateway` is used in this example
    name: apigwDemo # Instance name, which is required
    app: appDemo # Next.js application name, which is optional
    stage: dev # Information for identifying environment, which is optional. The default value is `dev`
      region: ap-guangzhou
        - http
        - https
      serviceName: serverless
      environment: release
        - path: /
          protocol: HTTP
          method: GET
          apiName: index
            functionName: myFunction

    Detailed Configuration >>


    Run the following command to deploy by scanning code:

    sls deploy


    To grant persistent permission, please see Account Configuration.


    You can run the following command to remove the deployed service:

    sls remove

    Account configuration (optional)

    Currently, you can scan a QR code to log in to the CLI by default. If you want to configure persistent environment variables/key information, you can also create a local .env file:

    touch .env # Tencent Cloud configuration information

    Configure Tencent Cloud's SecretId and SecretKey information in the .env file and save it:

    # .env


    • If you don't have a Tencent Cloud account yet, please sign up first.
    • If you already have a Tencent Cloud account, you can get SecretId and SecretKey in API Key Management.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support