Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play framework and REST

Well, I love Play so far and I was hoping to prod the community for success and failure stories of trying to develop a great REST app. I have extensive experience with Django and thought of applying some methodologies from http://django-tastypie.readthedocs.org/en/latest/?redir API creation package to Play.

Have you found a good equivalent to exposing Models through and API package with flexible settings for throttling, data output whitelisting, data output formatting, automatic api url routes and so on ?

like image 884
Arek B. Avatar asked May 01 '11 13:05

Arek B.


People also ask

What is play framework used for?

Play Framework makes it easy to build web applications with Java & Scala. Play is based on a lightweight, stateless, web-friendly architecture. Built on Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

What is meant by REST framework?

Overview. A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.

Is Play framework backend?

Play comes with two configurable server backends, which handle the low level work of processing HTTP requests and responses to and from TCP/IP packets. Starting in 2.6. x, the default server backend is the Akka HTTP server backend, based on the Akka-HTTP server. Prior to 2.6.


1 Answers

A few time ago, there has been a discussion about exposing Models on play google group. It was quite a picky discussion because the audience was completely cut in 2 groups:
- the ones who would really like this feature and want it absolutely.
- the ones who say it's a really bad (even dangerous) manner to expose directly your model on presentation layer because it break the MVC design and expose directly your business data with potential security or data integrity breaches etc...

I'm not in any group and I simply consider the question objectively...
When looking at this Django API, I think that it's not much a problem if you can control how your model is exposed and what exactly is exposed. But I don't know anything doing it out of the box in Play!... I don't know if the guy who began the discussion evoked here before has ever finished his module... Anyway, the CRUD module already does something like that because it introspects your model fields to expose a CRUD interface... so exposing it as REST would just be a matter of presentation (and some work) IMHO.

like image 166
mandubian Avatar answered Nov 18 '22 18:11

mandubian