One suggestion, I sent 4 days with serverless only to realize that I need to understand Lambda and the whole architecture first. If you are new to the whole thing, I would skip serverless framework for now and then go back at it since it's very useful. Ok to your question:
This is the basic httpApi format:
functions:
params:
name: myLambdaName
handler: index.handler
events:
- httpApi:
path: /v1/test
method: get
Here's the official documentation in case you need it.
This is how everything COULD look in the serverless.yml file, I put some comments so you understand what's going on:
service: my-express-application
frameworkVersion: "2"
provider:
name: aws
stackName: myName # Use a custom name for the CloudFormation stack
runtime: nodejs12.x
lambdaHashingVersion: 20201221
stage: v1 # your default stage, the one lambda and all services define here will use
region: us-east-1 # <- This is your regeion, make sure it is or change it
httpApi: # rdefining your existing api gateway
# id: xxx # id of externally created HTTP API to which endpoints should be attached. This will allow you to use it but this lambda can't modify it
payload: "2.0" # the latest payload version by aws is 2.0
name: "v1-my-service" # Use custom name for the API Gateway API, default is ${opt:stage, self:provider.stage, 'dev'}-${self:service} you will only be able to modify it if you created the api using this stack and not referencing it above
cors: false # Implies default behavior, can be fine tuned with specficic options
timeout: 10
logRetentionInDays: 7 # Set the default RetentionInDays for a CloudWatch LogGroup
functions:
params:
name: myLambdaName
handler: index.handler
events:
- httpApi:
path: /v1/test
method: get