unit dServer;

interface

uses
  System.SysUtils, System.Classes, Sparkle.HttpServer.Module,
  Sparkle.HttpServer.Context, Sparkle.Comp.Server,
  Sparkle.Comp.HttpSysDispatcher, Aurelius.Drivers.Interfaces,
  Aurelius.Comp.Connection, XData.Comp.ConnectionPool, XData.Server.Module,
  XData.Comp.Server,
  dDatabase;

type
  TServerContainer = class(TDataModule)
    SparkleHttpSysDispatcher: TSparkleHttpSysDispatcher;
    XDataServer: TXDataServer;
    procedure DataModuleCreate(Sender: TObject);
  end;

var
  ServerContainer: TServerContainer;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}

{$R *.dfm}

procedure TServerContainer.DataModuleCreate(Sender: TObject);
begin
  // Create the database structure
  TDatabaseModule.ExecSQL(
    'CREATE TABLE IF NOT EXISTS CUSTOMERS ( ' +
    '  ID INTEGER PRIMARY KEY, ' +
    '  NAME VARCHAR(150), ' +
    '  COUNTRY VARCHAR(150) ' +
    ')');
end;

end.
