av1m / functions-multiple-endpoints

Run multiple endpoints on Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions)

Home Page:https://pypi.org/project/functions-wrapper/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run multiple endpoints on Google Cloud Functions and Amazon Lambda

This example show how to run multiple endpoints on Google Cloud Functions and Amazon Lambda.

By default, functions-framework-python can't run multiple endpoints on the same function.

I present two examples here:

Get started

Install the dependencies:

pip install functions_wrapper
# main.py 
from flask import Flask
from functions_wrapper import entrypoint

app = Flask(__name__)

@app.route("/")
def home():
    return "Hello World!"

@app.route("/test")
def test():
    return "Hello Test!"

app_wrap = lambda request: entrypoint(app, request)

Run this file with functions-framework:

functions_framework --target app_wrap

About

Run multiple endpoints on Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions)

https://pypi.org/project/functions-wrapper/

License:MIT License


Languages

Language:Python 100.0%