EVE - define custom flask controllers [closed]
Asked Answered
A

1

10

I'm using EVE for couple of days to create my own REST API but I want to have custom Flask Controller integrated with EVE is there any possibility to do this? Thanks.

Amine answered 11/2, 2014 at 11:5 Comment(0)
A
26

Ok I will answer my own question. After reading more about Eve, you can use any of Flask's methods because Eve is simply inheriting from the Flask class. For example, you can do this:

from eve import Eve
app = Eve()

@app.route("/x")
def hello():
    return "Hello World!"


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

There's more info at the Flask documentation site here: Flask

Amine answered 12/2, 2014 at 23:32 Comment(2)
that's right. You can mark your own question as solved, so other people will see it.Dominique
eve documentation has this snippet, showing how to use flask blueprints to do the same. It helps keep things organized when growing bigger.Astronautics

© 2022 - 2024 — McMap. All rights reserved.