You are not logged in.
Pages: 1
I tried to test a bare, hello world MVC project in FPC/linux. I created an interface, IBareApplication descendant of IMVCApplication with no extra methods and a class, TBareApplication, descendant of TMVCApplication which implements the IBareApplication. This class has only two methods Start and Default. Start calls only the inherited method and Default is empty. Then I created the Views folder with Default and Error html files, the former contains the hello world message and the latter is a modified copy from the Sample 30.
The main file creates an empty model, an in memory Rest Server and the above application:
aModel := TSQLModel.Create([],'test');
try
aServer := TSQLRestServerFullMemory.Create(aModel);
try
aApplication := TBareApplication.Create;
try
aApplication.Start(aServer);
aHTTPServer := TSQLHttpServer.Create('8092',aServer);
try
aHTTPServer.RootRedirectToURI('test/default');
aServer.RootRedirectGet := 'test/default';
writeln('Running, press ENTER to exit');
readln;
finally
...
When I try to access localhost:8092/ it redirects to http://localhost:8092/test/default as expected, with a Json response contains an Error 400/Bad request message. What am I missing here?
Offline
Start calls only the inherited method...
I missed one more call after the inherited Start method. This call in its simplest form (without any cache) is:
fMainRunner := TMVCRunOnRestServer.Create(Self);
Offline
Pages: 1