EVE - 定义自定义烧瓶控制器 [英] EVE - define custom flask controllers

查看:158
本文介绍了EVE - 定义自定义烧瓶控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用EVE创建了自己的REST API,但是我想将自定义的Flask控制器与EVE集成在一起,有没有可能做到这一点?谢谢。

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.

推荐答案

好吧,我会回答我自己的问题。在阅读更多关于Eve之后,你可以使用Flask的任何方法,因为Eve只是从Flask类继承而来。例如,你可以这样做:

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)

这里有更多的信息在Flask文档站点: Flask

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

这篇关于EVE - 定义自定义烧瓶控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆