<< Click to Display Table of Contents >> Navigation: »No topics above this level« Getting started |
Steps to create minimal working example:
1. Create new Delphi project
2. Copy /web and /sql folders into your project directory.
3. Add DMSchema, DMFireDac, htwebui, htwebuiwin into uses list.
4. Declare variables in Form
Root: string;
Server: TWebUIServer;
5. In FormCreate event write
Root := '<project path>';
Server := TWebUIServer.Create(Root + 'web\', TWebUISysAdapter);
Server.UIProviderPool := TDMProviderPool.Create(TDMFDProvider, Root + 'ui.db', SQLite);
Server.ProviderPool := TDMProviderPool.Create(TDMFDProvider, '<db_connection>@user;password', <database type>);
6. Add CreateUI button with the following OnClick code
var UB: TWebUIBuilder;
begin
UB := TWebUIBuilder.Create(Server.ProviderPool, Server.UIProviderPool, TWebUILang, Root);
try
UB.CreateTables; // create tables for UI in ui.db SQLIte database
UB.BuildUI; // Create UI from main database structure
finally
UB.Free;
end;
7. Add Start button with the following OnClick code
Server.Start;
8. Run application, press first button then second button.
Now you can open localhost page in browser.
Note that when using TWebUISysAdapter application should run with Administrator privileges because it uses http.sys windows HTTP server.