Operation Scenarios
This document describes how to use the API Gateway component provided by Serverless Framework to quickly create and deploy an API Gateway service/API.
Prerequisites
You have installed Serverless Framework.
Directions
Configuring API Gateway service
Create the serverless.yml
file locally:
Configure serverless.yml
as follows:
component: apigateway
name: apigwDemo
org: orgDemo
app: appDemo
stage: dev
inputs:
region: ap-guangzhou
protocols:
- http
- https
serviceName: serverless
environment: release
endpoints:
- path: /
protocol: HTTP
method: GET
apiName: index
function:
functionName: myFunction
Deploying API Gateway service
Run the following command to deploy by scanning code:
Removing deployed service
You can run the following command to remove the deployed service:
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:
Configure Tencent Cloud's SecretId
and SecretKey
information in the .env
file and save it:
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
Note:
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.
Was this page helpful?