You are not logged in.
Pages: 1
Hello ab,
I'm trying to integrate AngularJs and mORMot.
for development use the "grunt serves" to the single page app and it consumes one TSQLRestServerFullMemory server, it is working ok.
But to deploy THttpApiServer need to use a server as in example 09 - HttpApi web server. And I'm not understanding how this works.
Must have the same executable using THttpApiServer TSQLRestServerFullMemory?
Is this possible?
I did not understand the architecture?
thanks for listening
Offline
Take a look at mORMotHTTPServer.pas and the corresponding documentation in the SAD 1.18 pdf - see paragraph "Network and Internet access via HTTP" for instance.
You can have several TSQLRestServer* instances in the same TSQLHttpServer.
This is the TSQLHttpServer instance which will its own THttpApiServer instance manage one or several TSQLRestServer* instances.
To server static file, the easiest is to define a method based service in your TSQLRestServerFullMemory, and return file directly:
procedure TServiceServer.Files(Ctxt: TSQLRestServerURIContext);
var FN: TFileName;
begin
FN := Ctxt.ResourceFileName;
if FN='' then
Ctxt.Redirect('Files/index.html') else
Ctxt.ReturnFile(fPath+FN,true);
// writeln(FindIniNameValue(pointer(Ctxt.Call.InHead),'REMOTEIP: '),' ',
// Ctxt.Call^.Method,' ',Ctxt.URIWithoutSignature,' ',Ctxt.Call^.OutStatus);
end;
This will let static content be served in localhost:888/root/Files URI (if your model has "root" as root name).
Offline
Thanks AB,
I'll try it.
Offline
Hi again AB,
Similar of sample 26 - RESTful ORM with Blob method?
I do not understand, how or who will call the Files method.
Could you explain further or build a simple example with index.html?
Thank you for your attention
Offline
This is a method-based service.
Routing will be automatic, from the method name.
From the above code, TServiceServer.Files() will let static content be served in localhost:888/root/Files URI.
888 is the HTTP server port.
root is the Model "root" parameter".
Files is the method name.
Offline
Hello AB,
Thank you.
"localhost:888/root/Files" running my index.html file
It is possible to make "localhost 888/root/" redirects to index.html?
Offline
Pages: 1