API Gateway

The framework provides support for routed functions via the Serverless Gateway project that can be deployed separately. For more information, please consult the Serverless Gateway Documentation or the Serverless Gateway Repository.


  • Write your routed function

# In app.py

app = Serverless("example")

# You can use the get, post, put, and delete decorators
@app.get("/hello-gateway", memory_limit= 256)
def handler(event, context):
   return {"body": "Hello from Gateway!"}
  • Install the scwgw helper tool

pip install scw-gateway
  • Deploy your API Gateway

scwgw infra deploy
  • Finally, use scw-serverless to deploy your function and set up the route on your gateway:

scw-serverless deploy app.py
  • You can now call your function via your Gateway!

$ GATEWAY_ENDPOINT=$(scwgw infra endpoint)
$ curl https://${GATEWAY_ENDPOINT}/hello-gateway
> Hello from Gateway!