flask-RESTful vs flask-RESTless, which should be used, and when [closed]
Asked Answered
S

1

21

What are the key differences of these two libraries.In terms of usability, and features

If you already have a huge number of model classes, using flask-restLESS makes perfect sense, right?. What are the features it would lack, if it would done with flask-restful. Or, what are flask-restful gives you, that flask restless can't provide.?

Septuor answered 13/6, 2016 at 7:25 Comment(0)
R
29

While I'm sure there's going to be a significant of overlap between Flask-RESTful and Flask-RESTless, here's the difference in orientation as far as I can tell:

Flask-RESTful aims to be generic, it's a "lightweight abstraction that works with your existing ORM/libraries". Your resources don't even have to be a model tied to a database, and it could be anything.

On the other hand, Flask-RESTless makes it clear that their best use case is "creating simple ReSTful JSON APIs from SQLAlchemy models"

So if you have a lot of SQLAlchemy models and need fairly standard REST API from those, you can use Flask-RESTless to speed up the development, you need minimal code to expose your models into the API.

If you have custom endpoints, or want to use models that aren't backed by SQLAlchemy you can create your own on Flask-RESTful

How to decide / or use both

You can do customize Flask-RESTless too (serialization, custom queries etc), with sufficient code you can use either frameworks.

To decide e.g. ask yourself do you have more structured model-based APIs or more custom APIs, that would save you the most development time and only deal with special cases when they arise.

And You can use both in a single Flask app, no problems there, you just e.g. map /api/resource-a/ to a Flask-RESTless API and /api/resource-b/ to another API from made with Flask-RESTful

Rigorism answered 13/6, 2016 at 7:46 Comment(4)
SO are you saying restLESS is only good for basic CRUD API's !. What if i wanted custom endpoints in flask restLESS., Is there a way.?Septuor
Also, Can i use Both libraries, in my project. You know, flask restless for crud API's, and flask restful for my business logic and stuff. Are they play well with each other, or DO they fight like cats.Septuor
You can do custom queries with Flask-RESTless, with sufficient code you can use either frameworks. You can decide e.g. do you have more structured model-based APIs or more custom APIs, that would save you the most development time and only deal with special cases when they arise. And You can use both in a single Flask app, no problems there, you just e.g. map /api/thing1/ to a Flask-RESTless API and /api/thing2/ to another API from made with Flask-RESTfulRigorism
Holly.... That's it, i'll try to achieve my objectives using restLESS, if not I'll use restFUL, where i needed. Thanks bro, have a nice day.Septuor

© 2022 - 2024 — McMap. All rights reserved.