I've created a simple API using Flask, my question is how do i make it list all of the resources or endpoints it has been assigned
from flask import Flask, request
from flask_restful import Resource, Api
from sqlalchemy import create_engine
from json import dumps
import os, random
app = Flask(__name__)
api = Api(app)
class cuddle(Resource):
def get(self):
file = random.choice(os.listdir("/path/to/dir/of/images"))
out = "https://example.com/path/" + file
return out
api.add_resource(cuddle, '/api/cuddle')
if __name__ == '__main__':
app.run(host="0.0.0.0", port=33, debug=True)
I'm wanting to be able to go to example.com/api/endpoints
and for it to list all of the available endpoints, such as in the snippet cuddle