Host two Apache loadable modules but limit each one to a separate DB table

Hi,

I have a Postgres database with two tables: customer and schools

My server's name is ubuntu

I then created two separate Apache loadable modules
libmod_slimzulu.so to display the json data for table schools only
libmod_xdata.so to display the json data for table customer only

In the WebModule of libmod_slimzulu.so

initialization
Server := TWebBrokerServer.Create;
FireDacPostgreSQLConnection := TFireDacPostgreSQLConnection.Create(nil);
TDatabaseManager.Update(TFireDacPostgreSQLConnection.CreateConnection);

Server.Dispatcher.AddModule(TXDataServerModule.Create(
'http://ubuntu/slimzulu', TFireDacPostgreSQLConnection.CreateConnection
));

In the WebModule of libmod_xdata.so

initialization
Server := TWebBrokerServer.Create;
FireDacPostgreSQLConnection := TFireDacPostgreSQLConnection.Create(nil);
TDatabaseManager.Update(TFireDacPostgreSQLConnection.CreateConnection);

Server.Dispatcher.AddModule(TXDataServerModule.Create(
'http://ubuntu/tms', TFireDacPostgreSQLConnection.CreateConnection
));

libmod_slimzulu.so refer only to table schools in its TAureliusConnection
libmod_xdata.so refer only to table customer in its TAureliusConnection

The idea was that the url http://ubuntu/slimzulu must show the json data of table schools only and the url http://ubuntu/tms must show the json data of table customer only. But the problem is that http://ubuntu/slimzulu show the json data of both tables schools and customer.

In Ubuntu server, the following files are in folder /etc/apache2/mods-enabled

slimzulu.load with contents:
LoadModule slimzulu_module /home/nols/PAServer/scratch-dir/Ansie-ubuntu/mod_slimzulu/libmod_slimzulu.so

xdata.load with contents:
LoadModule xdata_module /home/nols/PAServer/scratch-dir/Ansie-ubuntu/mod_xdata/libmod_xdata.so

The contents of slimzulu.conf:

<Location /slimzulu>
        SetHandler libmod_slimzulu-handler
</Location>

The contents of xdata.conf:

<Location /tms>
	SetHandler libmod_xdata-handler
</Location>

Regards

Nols Smit

Please delete this question, I had a Delphi unit in-use created during the tutorial .. Part5: TXData/Aurelius server.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.