A
A
afiskon2014-06-08 14:49:28
Java
afiskon, 2014-06-08 14:49:28

Choosing a framework for creating REST services

Part of the question that you don't need to read:
Anyone who has ever worked on REST services knows that it's pretty boring. You create a resource, say that you can go to it by such and such methods, records have a certain set of fields with restrictions on their values, as well as default values. This is often stored in a regular RDBMS. Well, plus there are several views, for example, json and csv, a couple of simple features such as filtering by value-range, specifying the fields that need to be given when reading, it is also possible to subscribe to updates, automatic migration of the database schema and the ability to create views for tricky business -rules.
The crux of the matter:
As far as I can tell, there are many frameworks in the Java world that allow you to get all of the above, as well as automatically generate documentation and clients for a REST service in ten PLs, by simply describing resources on some DSL. What framework would you recommend? What can you or one of your colleagues say about it from your own experience of using it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-06-08
Protko @Fesor

Symfony has all the tools you need (Fos/rest-bundle, jms/serializer-bundle, annotations, lots of goodies).
For the last year I have been writing REST-Api on Silex + Doctrine. Everything is actually the same as in Symfony, only the structure is a little simpler. Well, yes, you need to spend a day or two setting up a template for the project (so that you can use all the same annotations, jms-serializer, all sorts of helpers, a documentation generator, etc.). And already this template can be reused.
Moreover, you can further minimize the routine if you use request data deserialization, but there are nuances. You can also use middleware
to implement all sorts of useful things like CORS or OAuth(Supports all frameworks that implement HttpkernelInterface, that is, Symfony, Silex, Laravel, etc. Well, you can stick a decorator to any framework).

Y
Yuri Yarosh, 2015-10-15
@voidnugget

I don’t know about any such “set of frameworks” in question.
Now, apart from swagger-codegen 'a, there were no normal code generators, it is friends with Scalatra and play2. In principle, you can write any template for code generation for whatever your heart desires, and this is not such a dreary task as it is commonly thought. Swagger
spec generation , along with endpoints according to the database schema, is only in the plans of typesafe so far, they also wanted to write an automatic REST file with template controllers, ala tastypie under Scala. There is also django-rest-framework from the same series and all this junk has been repeatedly rewrittenunder Node.js. Under PHP, no such prodigies were noticed - it is also customary to "code-generate" according to database schemas, and there were also goodies for generating Swagger's spec.
I'm planning to write something similar for Vert.x .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question