def app_factory(API_NAME="api"):
"""Create an app object."""
app = Flask(__name__)
CORS(app)
app.url_map.strict_slashes = False
api = Api(app)
api.add_resource(Index, "/"+API_NAME+"/", endpoint="api")
api.add_resource(Vocab, "/"+API_NAME+"/vocab", endpoint="vocab")
api.add_resource(Contexts, "/"+API_NAME+"/contexts/<string:category>.jsonld", endpoint="contexts")
api.add_resource(Entrypoint, "/"+API_NAME+"/contexts/EntryPoint.jsonld", endpoint="main_entrypoint")
api.add_resource(ItemCollection, "/"+API_NAME+"/<string:type_>", endpoint="item_collection")
api.add_resource(Item, "/"+API_NAME+"/<string:type_>/<int:id_>", endpoint="item")
return app
评论列表
文章目录