Skip to content

convert your serverless functions to flask applications.

License

Notifications You must be signed in to change notification settings

Glitchfix/flask-faas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Function as a Service

Linkedin Badge Gmail Badge Github Badge

flask-faas

Migrating from serverless to a server application can be a headache at times. flask-faas provides you a layer that sits on top of your existing serverless application handlers and helps them convert to Flask routes. The prime goal is to be easy to use and easier to port. We currently support Google Cloud Function, AWS Lambda and OpenFaaS. We would have Azure Functions on the roadmap shortly.

Installation

pip install flask-faas

Just import and use, no extra hassle!

from flask_faas.gcp import google_cloud_function
from flask_faas.aws import aws_lambda
from flask import Flask, jsonify

app = Flask(__name__)

@app.route("/gcp/<arg0>",methods=["GET"])
@google_cloud_function
def my_cloud_function_handler(req):
    return jsonify(req.view_args)

@app.route("/aws/<arg0>/<arg1>",methods=["GET"])
@aws_lambda
def my_lambda_handler(event, context):
    return jsonify([event["pathParameters"]])

if __name__ == '__main__':
    app.run()

Supported FaaS handler

  • Google Cloud Function
  • AWS Lambda
  • OpenFaaS

TODO

  • Azure Function
Resources:

Flask Google Cloud Function AWS Lambda OpenFaaS