Teapot and Mustache in Pharo 6?
Hello The TeaPot documentation [1] references Mustache [2] in the section 4.1. Response Transformers [3] There is an example for a JSON transformation but none for Mustache. Where do I find some information how to use Mustache together with Teapot? Regards Hannes [1] https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu... [2] https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu... [3] The responsibility of a response transformer is to convert the output of the action block to HTML and to set the content-type of the response. Some response transformers require external packages (e.g., NeoJSON, STON, Mustache). [4] Adapted example TLWebserver teapot GET: '/jsonlist' -> #(1 2 3 4); output: #json.
Hi Hannes, You can find some examples in the Enterprise Pharo book (http://files.pharo.org/books/enterprise-pharo/). Teapot on GET: '/greet' -> {'phrase' -> 'Hello'. 'name' -> 'World'}; output: (TeaOutput mustacheHtml: '<html>*{{phrase}}* /{{name}}/!</html>'); start. The {'phrase' -> 'Hello'. 'name' -> 'World'} servers as a model for the template engine. Imagine that this was returned by some domain logic. Anyway my preferred way of using Teapot is to use it as a REST (-like) backend and consume/produce JSON (or whatever) objects, instead of generating HTMLS on the server side via Mustache. Attila -- View this message in context: http://forum.world.st/Teapot-and-Mustache-in-Pharo-6-tp4963156p4963167.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
You have a also mustaside a bridge between mustache and seaside. On Mon, Aug 21, 2017 at 5:52 PM, H. Hirzel <hannes.hirzel@gmail.com> wrote:
Hello
The TeaPot documentation [1] references Mustache [2] in the section
4.1. Response Transformers [3]
There is an example for a JSON transformation but none for Mustache.
Where do I find some information how to use Mustache together with Teapot?
Regards Hannes
[1] https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu...
[2] https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu...
[3] The responsibility of a response transformer is to convert the output of the action block to HTML and to set the content-type of the response. Some response transformers require external packages (e.g., NeoJSON, STON, Mustache).
[4] Adapted example
TLWebserver teapot GET: '/jsonlist' -> #(1 2 3 4); output: #json.
Hi, On the Teapot + Mustache integration, Hannes, you may want to see my early prototype: http://smalltalkhub.com/#!/~Offray/Brea At some point, it will contain distributed wiki, backed by Fossil, now that we're thinking in empower community driven wiki like documentation. Offray El 21 de agosto de 2017 10:52:47 GMT-05:00, "H. Hirzel" <hannes.hirzel@gmail.com> escribió:
Hello
The TeaPot documentation [1] references Mustache [2] in the section
4.1. Response Transformers [3]
There is an example for a JSON transformation but none for Mustache.
Where do I find some information how to use Mustache together with Teapot?
Regards Hannes
[1] https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu...
[2] https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu...
[3] The responsibility of a response transformer is to convert the output of the action block to HTML and to set the content-type of the response. Some response transformers require external packages (e.g., NeoJSON, STON, Mustache).
[4] Adapted example
TLWebserver teapot GET: '/jsonlist' -> #(1 2 3 4); output: #json.
-- Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi brevedad.
participants (4)
-
Attila Magyar -
H. Hirzel -
Offray -
Stephane Ducasse