You are not logged in.
Pages: 1
My code is as follows, which was written in the reference forum
https://synopse.info/forum/viewtopic.php?id=2234
When I use a browser to access: http://127.0.0.1:8888/root/Example ,
Browser error prompt:
GET http://127.0.0.1:8888/assets/index -536d3432.js net::ERR_ABORTED 503 (Service Unavailable)
GET http://127.0.0.1:8888/assets/index -71dc7c95.css net::ERR_ABORTED 503 (Service Unavailable)
GET http://127.0.0.1:8888/favicon.ico 503 (Service Unavailable)
If I put the d: \ www directory into IIS, the browser can access it normally.
What can I do to make Mormot a web server, so that I don't have to install IIS, Apache or NGinx, just a simple mORMot executable is able to do web services and API services.
Thanks.
type
TSampleServer1 = class(TRestServerFullMemory)
published
procedure Example(C: TRestServerUriContext);
end;
procedure TSampleServer1.Example(C: TRestServerUriContext);
begin
C.ReturnFileFromFolder('d:\www');
end;
SampleServer := TSampleServer1.CreateWithOwnModel([], False, 'root');
HttpServer := TRestHttpServer.Create('8888', [], '+', HTTP_DEFAULT_MODE, 4);
HttpServer.AddServer(SampleServer);
Offline
You are messing with REST and HTTP servers, with a lot of confusion.
Take a look at
https://github.com/synopse/mORMot2/tree … rver-files
https://github.com/synopse/mORMot2/tree … server-raw
From our tests, our IOCP server is faster than http.sys on Windows.
Offline
procedure TSampleServer1.Example(C: TRestServerUriContext);
begin
C.ReturnFileFromFolder('d:\www');
end;
why it doesnt work?
Offline
You are using a REST server.
You need to register the published method - which I guess you don't.
If you take 5 minutes to look at the samples linked above, you will find the right pure HTTP class to use.
Offline
Pages: 1