Skip to content

FranciscoCarbonell/flask-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It is a simple way to implement a middleware to our flask application, we can receive the request in a decorator to modify any data or check.

install python setup.py install

or pip install flask-middleware

example

from flask import Flask,request
from flask_middleware import Middleware

app = Flask(__name__)
middleware = Middleware(app)

@middleware.middlewareEnviron
def middle(environ):
    args = Middleware.encode({'name':'value'})
    environ[Middleware.ARGS] = args
    return environ

@app.route('/',methods=['GET'])
def index():
    print(request.args)
    return 'hi'

app.run(debug=True)

About

make middleware in flask

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages