Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shibatanaoto/caffe2-for-lambda
https://github.com/shibatanaoto/caffe2-for-lambda
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/shibatanaoto/caffe2-for-lambda
- Owner: shibatanaoto
- Created: 2018-12-23T09:47:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-01T05:50:37.000Z (about 2 years ago)
- Last Synced: 2024-07-08T05:17:59.872Z (4 months ago)
- Language: Python
- Size: 15.2 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
serverless-flask
==========pip package for serverless framework
## Compatibility
This is tested with Python3.6 and Serverless Framework
## Installation
Command to install
```
pip install serverless-flask
```## Usage
Define `logger` and `middleware` annotation like below,
you can throw application log (Now logging level is only DEBUG) and add your custom middleware you define.
※ ) There is one thing to note. The order you annote should be `app.route`, `logger` and `middleware` from the top. If you change this order flask throw Exception. (in the future we wanna modify this restriction)
```
from serverless_flask.interceptor import Interceptor as interceptor@interceptor.logger
@interceptor.middleware(func1)
@interceptor.middleware(func2)
def test(*args, **kwargs):
return jsonify({
"message": "ok"
})
```As you can see in the below code, your custom middleware should have request parameter (but you don't have to use it.).
These functions must return the values with type of dict, list or tuple, otherwise Exception will be thrown.
```
from flask import requestdef func1(req: request):
return {'key': "value"}def func2(req: request):
return ['val1', 'val2']
```# Links
Website: coming soon
Code: https://github.com/Queue-inc/serverless-flask
Company Page: http://www.queue-inc.com