<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">El 22/02/2014 23:02, silvioprog
escribió:<br>
</div>
<blockquote
cite="mid:CAKq_V2JyygfrJhLu=3XAfyfWrsp24KaJqch3fdNrfgYAV4w6Uw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">2014-02-22 15:11 GMT-03:00 Giuseppe
Luigi <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:glpunzi@gmail.com" target="_blank">glpunzi@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<p>Sorry for late reply, too busy :(</p>
<p>What approach you follow to build your sites?
Jtemplate? Use brook just as restful server?</p>
</blockquote>
<div>I use it according the project. In several projects, I
use only GET/POST, JTemplate and HTML. But there are also
projects that I use GET/POST/PUT/DELETE, RESTful and some
JS library, such as JTable, for example. <br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Maybe I will do some testing with JTemplate, using Anderson(*)
videos as helpers.<br>
<br>
(*) <a class="moz-txt-link-freetext" href="http://www.youtube.com/watch?v=Y2ZozfS1aSg">http://www.youtube.com/watch?v=Y2ZozfS1aSg</a><br>
<br>
<blockquote
cite="mid:CAKq_V2JyygfrJhLu=3XAfyfWrsp24KaJqch3fdNrfgYAV4w6Uw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<p>Im still just trying to figure on my mind how to
"deploy" my idea to Brook development. My web
development skills are mainly based working over CMS</p>
<p>Regards.</p>
</blockquote>
</div>
<div>Some time ago, I have developed projects with CMS like
Joomla and WordPress. Yes, it is practical, but they don't
give me the same power to manipulate the content that will
displayed on the screen. But I've thought about creating a
CMS using Brook.<br>
</div>
</div>
</div>
</blockquote>
<br>
Well, mainly my web development projects are based on corporative
websites or eCommerce, not custom-made implementations. Here a CMS
is the best option. Now I want to build a Web App. Are different
kind of projects :P<br>
<br>
<blockquote
cite="mid:CAKq_V2JyygfrJhLu=3XAfyfWrsp24KaJqch3fdNrfgYAV4w6Uw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div>
</div>
<div><br>
</div>
<div>ps. The Brook 3.0 is being released with new ideas of
João Morais (<a moz-do-not-send="true"
href="https://github.com/jcmoraisjr">https://github.com/jcmoraisjr</a>).
It will be completely different from Brook 2.6.4. In the new
Brook, you can receive objets instead JSONs, see a small
comparison;<br>
</div>
<div><br>
</div>
<div>form.html:</div>
<div><br>
</div>
<div>
<div><!DOCTYPE HTML></div>
<div><html lang="en-US"></div>
<div><head></div>
<div><span class="" style="white-space:pre"> </span><meta
charset="UTF-8"></div>
<div><span class="" style="white-space:pre"> </span><title>Person</title></div>
<div></head></div>
<div><body></div>
<div><span class="" style="white-space:pre"> </span><form
action="<a moz-do-not-send="true"
href="http://localhost/cgi-bin/cgi1.bf">http://localhost/cgi-bin/cgi1.bf</a>"
method="post"></div>
<div><span class="" style="white-space:pre"> </span><input
type="text" name="id" /></div>
<div><span class="" style="white-space:pre"> </span><input
type="text" name="name" /></div>
<div><span class="" style="white-space:pre"> </span><input
type="submit" /></div>
<div><span class="" style="white-space:pre"> </span></form></div>
<div></body></div>
<div></html></div>
</div>
<div><br>
</div>
<div>Brook 2.6.4:</div>
<div><br>
</div>
<div>
<div>unit Unit1;</div>
<div><br>
</div>
<div>{$mode objfpc}{$H+}</div>
<div><br>
</div>
<div>interface</div>
<div><br>
</div>
<div>uses</div>
<div> BrookAction;</div>
<div>
<br>
</div>
<div>type</div>
<div> TMyAction = class(TBrookAction)</div>
<div> public</div>
<div> procedure Post; override;</div>
<div> end;</div>
<div><br>
</div>
<div>implementation</div>
<div><br>
</div>
<div>procedure TMyAction.Post;</div>
<div>begin</div>
<div> // where's validation?</div>
<div> Write('ID: %d, Name: %s', [Fields['id'].AsInt64,
Fields['name'].AsString]); // where's reuse?</div>
<div> // where's persistence?</div>
<div>end;</div>
<div><br>
</div>
<div>initialization</div>
<div> TMyAction.Register('/person');</div>
<div><br>
</div>
<div>end.</div>
</div>
<div><br>
</div>
<div>Brook 3.0:</div>
<div><br>
</div>
<div>
<div>unit person;</div>
<div><br>
</div>
<div>{$mode objfpc}{$H+}</div>
<div><br>
</div>
<div>interface</div>
<div><br>
</div>
<div>uses</div>
<div> SysUtils;</div>
<div><br>
</div>
<div>type</div>
<div> EPerson = class(Exception);</div>
<div><br>
</div>
<div>
{ TPerson }</div>
<div><br>
</div>
<div> TPerson = class</div>
<div> private</div>
<div> FId: Int64;</div>
<div> FName: string;</div>
<div> public</div>
<div> procedure Validate;</div>
<div> procedure Save;</div>
<div>
published</div>
<div> property Id: Int64 read FId write FId;</div>
<div> property Name: string read FName write FName;</div>
<div> end;</div>
<div><br>
</div>
<div>implementation</div>
<div><br>
</div>
<div>{ TPerson }</div>
<div><br>
</div>
<div>procedure TPerson.Validate;</div>
<div>begin</div>
<div> if Trim(FName) = '' then</div>
<div> raise EPerson.Create('Name must not be empty.');</div>
<div>end;</div>
<div><br>
</div>
<div>
procedure TPerson.Save;</div>
<div>begin<br>
</div>
<div> // implement your persistence here, using a framework
like dpof: <a moz-do-not-send="true"
href="https://github.com/silvioprog/dopf">https://github.com/silvioprog/dopf</a></div>
<div>end;</div>
<div><br>
</div>
<div>end.</div>
<div><br>
</div>
</div>
<div>
<div>unit Unit1;</div>
<div><br>
</div>
<div>{$mode objfpc}{$H+}</div>
<div><br>
</div>
<div>interface</div>
<div><br>
</div>
<div>uses</div>
<div> BrookAction, person;</div>
<div><br>
</div>
<div>type</div>
<div> TMyAction = class(specialize
TBrookEntityAction<TPerson>)</div>
<div> public</div>
<div> procedure Post; override;</div>
<div> end;</div>
<div><br>
</div>
<div>implementation</div>
<div><br>
</div>
<div>procedure TMyAction.Post;</div>
<div>begin</div>
<div> Entity.Validate; // Yes, my own validation!</div>
<div> Write('ID: %d, Name: %s', [Entity.Id, Entity.Name]);
// Yes, I'm reusing my object!<br>
</div>
<div> Entity.Save; // I love it, my validation using OPF
(like <a moz-do-not-send="true"
href="https://github.com/jcmoraisjr/jcore">https://github.com/jcmoraisjr/jcore</a>
or <a moz-do-not-send="true"
href="https://github.com/silvioprog/dopf">https://github.com/silvioprog/dopf</a>)
of DAO!</div>
<div>end;</div>
<div><br>
</div>
<div>initialization</div>
<div> TMyAction.Register('/person');</div>
<div><br>
</div>
<div>end.</div>
</div>
<br>
</div>
</div>
</blockquote>
<br>
<br>
Looks interesting. Are Brook 3 in your github too? When is planned
to release?<br>
<br>
Regards.<br>
</body>
</html>