-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add an example of a json service #978
Conversation
|
||
JSON is a very common interchange format for web services. Mojolicious loves | ||
JSON and makes it very easy to both build and use JSON services. In this example | ||
you can fetch module data from L<MetaCPAN|http://metacpan.org>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to write 'In this example we fetch module data from ...'?
Afraid i have to give this a 👎 , since the example is out of place and introduces features that are meant to be introduced much later in the tutorial. |
Thank you @jberger, I agree that:
Sorry for the apparent (yet, unintended) "snark" in previous comments. |
The tutorial is not intended as a reference guide. Indeed the problem is that the request's json methos is only described in the class reference documentation. I'm trying to correct the fact that it does not appear in the Guides which is where we want people to be introduced to the concepts. |
Closing this pull request for now. While most of us still believe that an example similar to this one should exist in the guides, @dancingfrog's behavior here and on other communication channels has resulted in an exodus of volunteers willing to work on it. |
For the record, a similar tutorial was added in cebbec8...56bb601 |
Summary
Interestingly, the Request's json method does not appear in any of the guides. This PR adds an example that uses it and other common json service functionality
Motivation
There does appear to be some confusion as to how to get the json representation of a request as evidenced by the google search results for "Mojolicious parse JSON body". Having a small example in the Tutorial seems like a simple place to start. I have chosen to place it after the GET and POST parameters section and the HTTP section since you need the concept of input parameters and also knowledge of the
->req
and->res
methods to establish these concepts. Thejson
stash value doesn't seem to be mentioned directly either but is rather introduced obliquely later, this also gives a nod in that direction.References
https://groups.google.com/forum/#!topic/mojolicious/_r-tzqKKtGI
#522 (comment)