<div dir="ltr"><div dir="ltr"><div>Hi Darius.</div><div><br></div><div dir="ltr">On Thu, Jun 27, 2019 at 1:10 PM Darius Blaszyk <<a href="mailto:dhkblaszyk@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">dhkblaszyk@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br><br>I have been asked to write a limited functionality / mini ERP type of software for an NGO that is setting up a hospital. I'm doing this in my own time and free of charge. The compiler and IDE of choice are of course FreePascal & Lazarus. I’m still thinking about the direction to go exactly with this and I was hoping to get some feedback/support from the community here as I always have gotten over the years.<br></blockquote><div><br></div><div>First of all, good luck in your project! :-)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The hardware of choice is already made and will be a network of several Chromebooks on which all staff will be logging in the system. This made me think that a desktop application is less feasible and I should look at a web-based solution. I found some frameworks such as ExtPascal, fano, Brook, pas2js. Unfortunately, I don't know much about web-based applications. So my question is whether any of the frameworks are mature enough to create a database driven application as described. Possibly there are other frameworks available that I don't know of but are worth investigating?<br></blockquote><div><br></div><div>There is an important project also for web/database purposes missing on the above list: mORMot. You should consider to investigate it too. :-)</div><div><br></div><div>Regarding Brook, there are two active versions of it:</div><div><br></div><div>1. <a href="https://github.com/risoflora/brookframework" rel="noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/risoflora/brookframework</a></div><div>2. <a href="https://github.com/risoflora/brookfreepascal" rel="noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/risoflora/brookfreepascal</a></div><div><br></div><div>Let me explain starting from option 2, BrookFreePascal, which I'm going to reference as B4F. As Michael commented (thanks dude! :-)), it is a long-standing FCL-based project, providing high-level features making it easy to develop FPC/Laz web applications. It was strong influenced by Slim Framework, also active nowadays and, like Slim, B4F uses a basic routing concept, which triggers predefined methods named as the same HTTP verbs, like Get, Post, Delete etc., declared in the public scope of an action class. The few lines below illustrates it:</div><div><br></div><div><font face="courier new, monospace" size="1">...</font></div><div><span style="font-family:"courier new",monospace;font-size:x-small">  THello = class(TBrookAction)</span><br></div><div><font face="courier new, monospace" size="1">  public<br>    procedure Get; override;<br>  end;<br></font></div><div><font face="courier new, monospace" size="1"><br></font></div><div><font face="courier new, monospace" size="1">procedure THello.Get;<br>begin<br>  Write('Hello Darius. I'm Brook on the Chromebook! :-)');</font></div><div><font face="courier new, monospace" size="1">end;<br><br>initialization<br>  </font><span style="font-family:"courier new",monospace;font-size:x-small">THello</span><font face="courier new, monospace" size="1">.Register('/hello');</font></div><div><span style="font-family:"courier new",monospace;font-size:x-small">...</span><br></div><div><br></div><div>If you run a Brook application containing these lines above, just navigate to "<font face="courier new, monospace" size="1">/hello</font>" to get the message "<font face="courier new, monospace" size="1">Hello Darius. I'm Brook on the Chromebook! :-)</font>" on your web browser and have a lot of fun.</div><div><br></div><div>Now, I'm going to explain the option 1 a bit, the new Brook Framework, under active development, projected for Free Pascal and Delphi, which will be referenced in next lines as BF. It was entirely written from scratch with special care for embedded systems. BF routing was and is still inspired by projects like Express, Flask, Laravel, and its components follows some RAD concepts adopted by DataSnap/fpWeb. For example, if you have a console or VCL project, you can turn it into a web server application: at design time, just drag-drop three components (<font face="courier new, monospace" size="1">BrookLibraryLoader1</font>, <font face="courier new, monospace" size="1">BrookHTTPServer1</font> and <font face="courier new, monospace" size="1">BrookHTTPRouter1</font>) to a form or data module, define a regular expression pattern for a route item and implement its request event:</div><div><br></div><div><font face="courier new, monospace" size="1">... [.lfm or .dfm]</font></div><div><font face="courier new, monospace" size="1"><br></font></div><div><font face="courier new, monospace" size="1">  object BrookHTTPRouter1: TBrookHTTPRouter<br>    Routes = <    <br>      item<br>        Pattern = '/hello/(?P<name>[a-zA-Z]+)'<br>        OnRequest = BrookHTTPRouter1Routes0Request<br>      end><br>  end<br></font></div><div><font face="courier new, monospace" size="1"><br></font></div><div><font face="courier new, monospace" size="1">... [.pas]</font></div><div><font face="courier new, monospace" size="1"><br></font></div><div><font face="courier new, monospace" size="1">procedure TForm1.BrookHTTPRouter1Routes0Request(ASender: TObject;<br>  ARoute: TBrookHTTPRoute; ARequest: TBrookHTTPRequest;<br>  AResponse: TBrookHTTPResponse);<br>begin<br>  AResponse.SendFmt('Hello %s', [ARoute.Variables['name']], 'text/html', 200);<br>end;<br></font></div><div><font face="courier new, monospace" size="1"><br></font></div><div><font face="courier new, monospace" size="1">...</font></div><div><br></div><div>This way, if you navigate to "<font face="courier new, monospace" size="1">/hello/Darius</font>", the message "<font face="courier new, monospace" size="1">Hello Darius</font>" will be displayed on the browser, however, any other invalid value, like "<font size="1" face="courier new, monospace">/hello/<b>123</b></font>", will be automatically refused, due to pattern "<font face="courier new, monospace" size="1">/hello/(?P<name>[a-zA-Z]+)</font>" defined to the route item.</div><div><br></div><div>There are a lot of features (three threading models, data compression, on-demand content, JIT optimizations, etc.) with focus on performance that I couldn't detail in a single message, but the most important info: BF loads a GNU C library which provides a low-level API containing common HTTP features that are a good replacement for HTTP servers like Apache, Nginx, NodeJS, Civetweb and so on. In short, you can run your application in production and provide web services in the same (or higher) performance as those servers, just distributing a small single-file library with your executable, that probably will already be using other library, like the database client one, for example.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">As I am starting this endeavor I would welcome any advisory or practical help. If someone is willing to support in any form, please contact me via PM.<br><br>TIA for all pointers, tips, and suggestions.<br><br>Regards, Darius</blockquote><div><br></div><div>I'd like to make a naive suggestion for you regarding to server side. You mentioned about several Chromebooks logging to the system. So, beforehand, what do you think about simulating that scenario? It is a little bit easy to do: there are tools like wrk, JMeter, ApacheBench etc. you could use to trigger several requests generating reports by itself like <a href="https://github.com/risoflora/libsagui/tree/master/examples/benchmark" rel="noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">those ones</a>. IMHO, it could be a reasonable way to choose the proper package/server to serve your requirements.</div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div>