jfinkels / flask-restless

NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless.readthedocs.io
GNU Affero General Public License v3.0
1.02k stars 301 forks source link

endpoint prefix #652

Open mixmastamyk opened 7 years ago

mixmastamyk commented 7 years ago

Hi,

I use endpoint names to decide whether to redirect to login form and was hoping that the ones from this package could have a prefix like the others. For example:

But restless' endpoints look like this:

Would you mind prefixing them with "api." or something? I probably could use .endswith('api') to detect them but a prefix would match the others better.

Thanks.

jfinkels commented 7 years ago

Try using something like

app = Flask()
manager = APIManager(...)
blueprint = manager.create_api_blueprint('foobar.whatever', ...)
app.register_blueprint(blueprint)

The APIManager.create_api_blueprint() method allows you to specify the name of the Blueprint as the first argument.

mixmastamyk commented 7 years ago

Hmm, from what I gather about the flask extensions I've encountered so far, this is done by the extension itself.