Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glitchfix/flask-faas
convert your serverless functions to flask applications.
https://github.com/glitchfix/flask-faas
aws aws-lambda cloud flask gcp-cloud-functions migration openfaas python serverless serverless-functions
Last synced: about 2 months ago
JSON representation
convert your serverless functions to flask applications.
- Host: GitHub
- URL: https://github.com/glitchfix/flask-faas
- Owner: Glitchfix
- License: mit
- Created: 2021-07-20T20:37:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-22T11:14:48.000Z (over 3 years ago)
- Last Synced: 2024-10-13T17:22:14.523Z (3 months ago)
- Topics: aws, aws-lambda, cloud, flask, gcp-cloud-functions, migration, openfaas, python, serverless, serverless-functions
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Flask Function as a Service
[![Linkedin Badge](https://img.shields.io/badge/-Shivanjan%20Chakravorty-blue?style=plastic&logo=Linkedin&logoColor=white&link=https://www.linkedin.com/in/shivanjan/)](https://www.linkedin.com/in/shivanjan/) [![Gmail Badge](https://img.shields.io/badge/-schakravorty846-c14438?style=plastic&logo=Gmail&logoColor=white&link=mailto:[email protected])](mailto:[email protected]) [![Github Badge](https://img.shields.io/github/followers/Glitchfix?label=Glitchfix&logo=github&style=plastic)](https://github.com/Glitchfix)
## 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](https://cloud.google.com/functions/), [AWS Lambda](https://aws.amazon.com/lambda/) and [OpenFaaS](https://www.openfaas.com/). We would have Azure Functions on the roadmap shortly.## Installation
```py
pip install flask-faas
```## Just import and use, no extra hassle!
```py
from flask_faas.gcp import google_cloud_function
from flask_faas.aws import aws_lambda
from flask import Flask, jsonifyapp = Flask(__name__)
@app.route("/gcp/",methods=["GET"])
@google_cloud_function
def my_cloud_function_handler(req):
return jsonify(req.view_args)@app.route("/aws//",methods=["GET"])
@aws_lambda
def my_lambda_handler(event, context):
return jsonify([event["pathParameters"]])if __name__ == '__main__':
app.run()
```### Supported FaaS handler
- [x] Google Cloud Function
- [x] AWS Lambda
- [x] OpenFaaS### TODO
- [ ] Azure Function##### Resources:
[Flask](https://flask.palletsprojects.com/)
[Google Cloud Function](https://cloud.google.com/functions/)
[AWS Lambda](https://aws.amazon.com/lambda/)
[OpenFaaS](https://www.openfaas.com/)