You are not logged in.
Is there a possibility to organize a kind of workplaces using framework in order a separate copy of data is created on the server for each client?
If the client User_A connects to the server, the database for this client will be d:\storage_User_A.db
StorageServer := TSQLRestServerDB.Create(StorageModel, 'd:\storage_User_A.db3', true);
For User_B the database will be d:\storage_User_B.db accordingly.
RestClient -> URL: http://localhost/root/User_A/SampleRecord -> RestServer -> DB_User_A.db3
RestClient -> URL: http://localhost/root/User_B/SampleRecord -> RestServer -> DB_User_B.db3
Offline
Is it possible to register (AddServer) TSQLRestServerDB created in the interface based service method to the TSQLWebServer (HttpServer)?
unit GroupItemInterface;
type
IGroup = interface(IInvokable)
['{9A60C8ED-CEB5-4E19-88D4-4A16F496E5FE}']
function Connect(ID: integer): integer;
end;
unit MyServer;
type
TGroupItem = class(TInterfacedObject, IGroup)
protected
FModel : TSQLModel;
FServer : TSQLRestServerDB;
public
destructor Destroy; override;
public
function Connect(ID: Integer): Integer;
end;
....
Type
TMyServer = class(TObject)
private
HttpServer : TSQLWebServer;
AbkServer : TSQLRestServerFullMemory;
end;
...
GroupItemModel := CreateGroupItemModel;
AbkServer := TSQLRestServerFullMemory.Create(GroupItemModel,'users.json',false,true);
AbkServer.ServiceRegister(TGroupItem,[TypeInfo(IGroup)],sicPerUser).SetOptions([],[optExecInMainThread,optFreeInMainThread]);
HttpServer := TSQLWebServer.Create('8080',[AbkServer]);
HttpServer.AccessControlAllowOrigin := '*';
..
function TGroupItem.Connect(ID: Integer): Integer;
begin
FModel := TSQLModel.Create([TEmailItem, TExclusionItem],'groupitem_'+inttostr(ID));
FModel.SetCustomCollationForAllRawUTF8('NOCASE');
FServer := TSQLRestServerDB.Create(FModel, 'd:\em\abk_'+inttostr(ID)+',db3', True);
FServer.CreateMissingTables(0);
end;
or am I on the wrong way?
Offline
What do you call "TSQLWebServer" class?
This is not a current mORMot class.
Download the latest version of the SAD pdf (1.18), you will find some useful information there.
In short, yes, the TSQLHttpServer is used to publish a TSQLRestServer* class content via HTTP.
You can even publish it on several TSQLRestServer, and/or via GDI message or named pipe.
Or directly access the TSQLRestServer* class content in-process.
Several TSQLRestServer* instances is possible, but perhaps not the best fit in your case.
Offline