You are not logged in.
I just created my first MVC server. When I change the html of a view, the changes are not visible in the browser. If I terminate the server and restart the application, changes are visible. I want to be able to change view files without restating the server, what should I do?
Offline
I think there is no ready-made methods of doing this.
Sorry, I misread your post and I thought you were talking about auto-reloading without refreshing the browser. AB has given you the correct answer.
Last edited by edwinsn (2016-01-09 03:00:13)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Could you please explain what is the proper way to do it? How can I disable cache of the templates?
For example:
TMVCRunOnRestServer.Create(Self).SetCache('Default',cacheNone,1);
does not work, cache is not disabled.
Offline
Please, can you answer my question?
Could you please explain what is the proper way to do it, how can I disable cache of the templates?
Offline
You can use code like that:
procedure TBlogApplication.Start(aServer: TSQLRestServer);
var
LParams: TMVCViewsMustacheParameters;
LViews: TMVCViewsAbtract;
begin
...
inherited Start(aServer, TypeInfo(IBlogApplication));
FillChar(LParams, SizeOf(LParams), 0);
// That's key point: check template modification every second
LParams.FileTimestampMonitorAfterSeconds := 1;
LParams.ExtensionForNotExistingTemplate := '.html';
LParams.Helpers := TSynMustache.HelpersGetStandardList;
LViews := TMVCViewsMustache.Create(Factory.InterfaceTypeInfo,
LParams, aServer.LogClass);
fMainRunner := TMVCRunOnRestServer.Create(Self, nil, '', LViews);
...
end;
Offline