flask_restful用法1

from flask import Flask
from flask_restful import Api,Resource

app = Flask(__name__)
api = Api(app)

class HelloWorld(Resource):
    def get(self):
        return {'hello': 'world'}

api.add_resource(HelloWorld, '/')

if __name__ == '__main__':
    app.run(debug=True)
posted @ 2021-04-12 22:13  ty1539  阅读(40)  评论(0编辑  收藏  举报