Flask-Express - ExpressJs apis for Flask¶
Introduction¶
Flask-Express is here to give you the feel like ExpressJs while using the Flask app. Basically you can use the default Request and Response as two parameters of the view functions.
Flask-Express comes with all the features of Flask with some extra features.
We are using the munch module to provide the attribute-style access very similar to the Javascript. I think this is enough for the introdunction, let's dig into the key features and the installation process.
Key Features¶
- It's provides you the feel of ExpressJs while using a Python based framework.
- The Resquest and The Response objects are easily available.
- It's clean and ExpressJs like apis provides a very readble syntex of your code.
- Support of Munch module gives a very advnatage and understandable attribute type parameters.
- Rich test cases support using pytest module.
- MKDocs based advanced documentation system.
Installation¶
The installation process is very similar to the other Python module installation process. You can install it directly from the PYPI using pip or from the source code.
Install or update from PYPI¶
python -m pip install -U Flask-Express
Install from source code¶
git clone https://github.com/marktennyson/flask-express && cd flask-express
python -m pip install -U .
A Basic Demo¶
inbuilt flask_express.FlaskExpress class
```python
from flask_express import FlaskExpress
app = FlaskExpress(__name__)
@app.get("/")
def index(req, res):
return res.json(req.header)
@app.get("/index-2")
async def index_2(req, res):
return res.json(req.header)