2017-01-29 16:11:04 +01:00
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Delphi MVC Framework
|
|
|
|
//
|
|
|
|
// Copyright (c) 2010-2017 Daniele Teti and the DMVCFramework Team
|
|
|
|
//
|
|
|
|
// https://github.com/danieleteti/delphimvcframework
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
// This IDE expert is based off of the one included with the DUnitX
|
|
|
|
// project. Original source by Robert Love. Adapted by Nick Hodges.
|
|
|
|
//
|
|
|
|
// The DUnitX project is run by Vincent Parrett and can be found at:
|
|
|
|
//
|
|
|
|
// https://github.com/VSoftTechnologies/DUnitX
|
|
|
|
// ***************************************************************************
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
unit DMVC.Expert.CodeGen.Templates;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
resourcestring
|
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
{ Delphi template code }
|
|
|
|
// 0 - project name
|
|
|
|
// 1 - http/s port
|
2017-04-14 17:28:18 +02:00
|
|
|
sDMVCDPR =
|
|
|
|
'program %0:s;' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
sLineBreak +
|
|
|
|
' {$APPTYPE CONSOLE}' + sLineBreak +
|
|
|
|
'' + sLineBreak +
|
|
|
|
'uses' + sLineBreak +
|
|
|
|
' System.SysUtils,' + sLineBreak +
|
2016-11-27 23:17:20 +01:00
|
|
|
' MVCFramework.Logger,' + sLineBreak +
|
2017-01-29 16:11:04 +01:00
|
|
|
' MVCFramework.Commons,' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' MVCFramework.REPLCommandsHandlerU,' + sLineBreak +
|
2017-09-21 23:11:19 +02:00
|
|
|
' Web.ReqMulti, {If you have problem with this unit, see https://quality.embarcadero.com/browse/RSP-17216}' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' Web.WebReq,' + sLineBreak +
|
|
|
|
' Web.WebBroker,' + sLineBreak +
|
|
|
|
' IdHTTPWebBrokerBridge;' + sLineBreak +
|
|
|
|
'' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
'{$R *.res}' + sLineBreak + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
'procedure RunServer(APort: Integer);' + sLineBreak +
|
|
|
|
'var' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' lServer: TIdHTTPWebBrokerBridge;' + sLineBreak +
|
|
|
|
' lCustomHandler: TMVCCustomREPLCommandsHandler;' + sLineBreak +
|
2017-05-10 23:28:13 +02:00
|
|
|
' lCmd: string;' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
'begin' + sLineBreak +
|
2017-01-29 16:11:04 +01:00
|
|
|
' Writeln(''** DMVCFramework Server ** build '' + DMVCFRAMEWORK_VERSION);' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' if ParamCount >= 1 then' + sLineBreak +
|
2017-05-10 23:28:13 +02:00
|
|
|
' lCmd := ParamStr(1)' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' else' + sLineBreak +
|
2017-05-10 23:28:13 +02:00
|
|
|
' lCmd := ''start'';' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
'' + sLineBreak +
|
|
|
|
' lCustomHandler := function(const Value: String; const Server: TIdHTTPWebBrokerBridge; out Handled: Boolean): THandleCommandResult' + sLineBreak +
|
|
|
|
' begin' + sLineBreak +
|
|
|
|
' Handled := False;' + sLineBreak +
|
|
|
|
' Result := THandleCommandResult.Unknown;' + sLineBreak +
|
|
|
|
'' + sLineBreak +
|
|
|
|
' // Write here your custom command for the REPL using the following form...' + sLineBreak +
|
|
|
|
' // ***' + sLineBreak +
|
|
|
|
' // Handled := False;' + sLineBreak +
|
|
|
|
' // if (Value = ''apiversion'') then' + sLineBreak +
|
|
|
|
' // begin' + sLineBreak +
|
|
|
|
' // REPLEmit(''Print my API version number'');' + sLineBreak +
|
|
|
|
' // Result := THandleCommandResult.Continue;' + sLineBreak +
|
|
|
|
' // Handled := True;' + sLineBreak +
|
|
|
|
' // end' + sLineBreak +
|
|
|
|
' // else if (Value = ''datetime'') then' + sLineBreak +
|
|
|
|
' // begin' + sLineBreak +
|
|
|
|
' // REPLEmit(DateTimeToStr(Now));' + sLineBreak +
|
|
|
|
' // Result := THandleCommandResult.Continue;' + sLineBreak +
|
|
|
|
' // Handled := True;' + sLineBreak +
|
|
|
|
' // end;' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
'' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' LServer := TIdHTTPWebBrokerBridge.Create(nil);' + sLineBreak +
|
|
|
|
' try' + sLineBreak +
|
|
|
|
' LServer.DefaultPort := APort;' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
'' + sLineBreak +
|
|
|
|
' { more info about MaxConnections' + sLineBreak +
|
|
|
|
' http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_MaxConnections.html }' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' LServer.MaxConnections := 0;' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
'' + sLineBreak +
|
|
|
|
' { more info about ListenQueue' + sLineBreak +
|
|
|
|
' http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_ListenQueue.html }' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' LServer.ListenQueue := 200;' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
'' + sLineBreak +
|
|
|
|
' WriteLn(''Write "quit" or "exit" to shutdown the server'');' + sLineBreak +
|
|
|
|
' repeat' + sLineBreak +
|
2017-05-10 23:28:13 +02:00
|
|
|
' if lCmd.IsEmpty then' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' begin' + sLineBreak +
|
2017-05-10 23:28:13 +02:00
|
|
|
' Write(''-> '');' + sLineBreak +
|
|
|
|
' ReadLn(lCmd)' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' end;' + sLineBreak +
|
2017-05-10 23:28:13 +02:00
|
|
|
' try' + sLineBreak +
|
|
|
|
' case HandleCommand(lCmd.ToLower, LServer, lCustomHandler) of' + sLineBreak +
|
|
|
|
' THandleCommandResult.Continue:' + sLineBreak +
|
|
|
|
' begin' + sLineBreak +
|
|
|
|
' Continue;' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
' THandleCommandResult.Break:' + sLineBreak +
|
|
|
|
' begin' + sLineBreak +
|
|
|
|
' Break;' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
' THandleCommandResult.Unknown:' + sLineBreak +
|
|
|
|
' begin' + sLineBreak +
|
|
|
|
' REPLEmit(''Unknown command: '' + lCmd);' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
' finally' + sLineBreak +
|
|
|
|
' lCmd := '''';' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
' end;' + sLineBreak +
|
|
|
|
' until false;' + sLineBreak +
|
|
|
|
'' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' finally' + sLineBreak +
|
|
|
|
' LServer.Free;' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
2017-04-14 17:28:18 +02:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
'end;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' ReportMemoryLeaksOnShutdown := True;' + sLineBreak +
|
2017-01-29 16:11:04 +01:00
|
|
|
' IsMultiThread := True;' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' try' + sLineBreak +
|
|
|
|
' if WebRequestHandler <> nil then' + sLineBreak +
|
|
|
|
' WebRequestHandler.WebModuleClass := WebModuleClass;' + sLineBreak +
|
|
|
|
' WebRequestHandlerProc.MaxConnections := 1024;' + sLineBreak +
|
|
|
|
' RunServer(%1:d);' + sLineBreak +
|
|
|
|
' except' + sLineBreak +
|
|
|
|
' on E: Exception do' + sLineBreak +
|
|
|
|
' Writeln(E.ClassName, '': '', E.Message);' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
'end.' + sLineBreak;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
// 0 - Unit Name
|
|
|
|
// 1 - Class Name
|
|
|
|
// 2 - Sample Methods - Interface
|
|
|
|
// 3 - Sample Methods - Implementation
|
|
|
|
// 4 - Action Filters - Interface
|
|
|
|
// 5 - Action Filters - Implementation
|
|
|
|
sControllerUnit = 'unit %0:s;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'interface' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'uses' + sLineBreak +
|
2017-01-18 21:53:53 +01:00
|
|
|
' MVCFramework, MVCFramework.Commons;' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
sLineBreak +
|
|
|
|
'type' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
' [MVCPath(''/'')]' + sLineBreak +
|
|
|
|
' %1:s = class(TMVCController) ' + sLineBreak +
|
|
|
|
' public' + sLineBreak +
|
|
|
|
'%2:s' +
|
|
|
|
'%4:s' +
|
2017-05-17 22:32:45 +02:00
|
|
|
'%6:s' +
|
2016-09-20 11:10:40 +02:00
|
|
|
' end;' + sLineBreak +
|
|
|
|
sLineBreak +
|
2017-01-18 21:53:53 +01:00
|
|
|
'implementation' + sLineBreak + sLineBreak +
|
2016-12-07 12:34:51 +01:00
|
|
|
'uses' + sLineBreak +
|
2017-05-17 22:32:45 +02:00
|
|
|
' System.SysUtils, MVCFramework.Logger, System.StrUtils;' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
sLineBreak +
|
|
|
|
'%3:s' + sLineBreak +
|
|
|
|
'%5:s' + sLineBreak +
|
2017-05-17 22:32:45 +02:00
|
|
|
'%7:s' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
sLineBreak +
|
|
|
|
'end.' + sLineBreak;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
sIndexMethodIntf =
|
|
|
|
' [MVCPath(''/'')]' + sLineBreak +
|
|
|
|
' [MVCHTTPMethod([httpGET])]' + sLineBreak +
|
|
|
|
' procedure Index;' + sLineBreak + sLineBreak +
|
2017-05-17 22:32:45 +02:00
|
|
|
' [MVCPath(''/reversedstrings/($Value)'')]' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' [MVCHTTPMethod([httpGET])]' + sLineBreak +
|
2017-05-17 22:32:45 +02:00
|
|
|
' procedure GetReversedString(const Value: String);' + sLineBreak;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
// 0 - Class Name
|
|
|
|
sIndexMethodImpl =
|
|
|
|
'procedure %0:s.Index;' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' //use Context property to access to the HTTP request and response ' + sLineBreak +
|
2017-01-29 16:11:04 +01:00
|
|
|
' Render(''Hello DelphiMVCFramework World'');' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
'end;' + sLineBreak + sLineBreak +
|
2017-05-17 22:32:45 +02:00
|
|
|
'procedure %0:s.GetReversedString(const Value: String);' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
'begin' + sLineBreak +
|
2017-05-17 22:32:45 +02:00
|
|
|
' Render(System.StrUtils.ReverseString(Value.Trim));' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
'end;' + sLineBreak;
|
2016-09-05 16:19:15 +02:00
|
|
|
|
2017-05-17 22:32:45 +02:00
|
|
|
sCRUDMethodsIntf =
|
|
|
|
sLineBreak +
|
|
|
|
' //Sample CRUD Actions for a "Customer" entity' + sLineBreak +
|
|
|
|
' [MVCPath(''/customers'')]' + sLineBreak +
|
|
|
|
' [MVCHTTPMethod([httpGET])]' + sLineBreak +
|
|
|
|
' procedure GetCustomers;' + sLineBreak + sLineBreak +
|
|
|
|
' [MVCPath(''/customers/($id)'')]' + sLineBreak +
|
|
|
|
' [MVCHTTPMethod([httpGET])]' + sLineBreak +
|
|
|
|
' procedure GetCustomer(id: Integer);' + sLineBreak + sLineBreak +
|
|
|
|
' [MVCPath(''/customers'')]' + sLineBreak +
|
|
|
|
' [MVCHTTPMethod([httpPOST])]' + sLineBreak +
|
|
|
|
' procedure CreateCustomer;' + sLineBreak + sLineBreak +
|
|
|
|
' [MVCPath(''/customers/($id)'')]' + sLineBreak +
|
|
|
|
' [MVCHTTPMethod([httpPUT])]' + sLineBreak +
|
|
|
|
' procedure UpdateCustomer(id: Integer);' + sLineBreak + sLineBreak +
|
|
|
|
' [MVCPath(''/customers/($id)'')]' + sLineBreak +
|
|
|
|
' [MVCHTTPMethod([httpDELETE])]' + sLineBreak +
|
|
|
|
' procedure DeleteCustomer(id: Integer);' + sLineBreak + sLineBreak;
|
|
|
|
|
|
|
|
sCRUDMethodsImpl =
|
|
|
|
'//Sample CRUD Actions for a "Customer" entity' + sLineBreak +
|
|
|
|
'procedure %0:s.GetCustomers;' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' //todo: render a list of customers' + sLineBreak +
|
|
|
|
'end;' + sLineBreak + sLineBreak +
|
|
|
|
'procedure %0:s.GetCustomer(id: Integer);' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' //todo: render the customer by id' + sLineBreak +
|
|
|
|
'end;' + sLineBreak + sLineBreak +
|
|
|
|
'procedure %0:s.CreateCustomer;' + sLineBreak + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' //todo: create a new customer' + sLineBreak +
|
|
|
|
'end;' + sLineBreak + sLineBreak +
|
|
|
|
'procedure %0:s.UpdateCustomer(id: Integer);' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' //todo: update customer by id' + sLineBreak +
|
|
|
|
'end;' + sLineBreak + sLineBreak +
|
|
|
|
'procedure %0:s.DeleteCustomer(id: Integer);' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' //todo: delete customer by id' + sLineBreak +
|
|
|
|
'end;' + sLineBreak + sLineBreak;
|
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
sActionFiltersIntf =
|
2017-01-18 21:53:53 +01:00
|
|
|
' protected' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' procedure OnBeforeAction(Context: TWebContext; const AActionName: string; var Handled: Boolean); override;'
|
|
|
|
+ sLineBreak +
|
|
|
|
' procedure OnAfterAction(Context: TWebContext; const AActionName: string); override;' +
|
|
|
|
sLineBreak;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
sActionFiltersImpl =
|
|
|
|
'procedure %0:s.OnAfterAction(Context: TWebContext; const AActionName: string); ' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' { Executed after each action }' + sLineBreak +
|
|
|
|
' inherited;' + sLineBreak +
|
|
|
|
'end;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'procedure %0:s.OnBeforeAction(Context: TWebContext; const AActionName: string; var Handled: Boolean);'
|
|
|
|
+ sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' { Executed before each action' + sLineBreak +
|
|
|
|
' if handled is true (or an exception is raised) the actual' + sLineBreak +
|
|
|
|
' action will not be called }' + sLineBreak +
|
|
|
|
' inherited;' + sLineBreak +
|
|
|
|
'end;' + sLineBreak;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
sDefaultControllerName = 'TMyController';
|
|
|
|
sDefaultWebModuleName = 'TMyWebModule';
|
|
|
|
sDefaultServerPort = '8080';
|
2016-02-24 22:37:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
// 0 = unit name
|
|
|
|
// 1 = webmodule classname
|
|
|
|
// 2 = controller unit
|
|
|
|
// 3 - controller class name
|
|
|
|
sWebModuleUnit =
|
|
|
|
'unit %0:s;' + sLineBreak +
|
|
|
|
'' + sLineBreak +
|
|
|
|
'interface' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'uses System.SysUtils,' + sLineBreak +
|
|
|
|
' System.Classes,' + sLineBreak +
|
|
|
|
' Web.HTTPApp,' + sLineBreak +
|
|
|
|
' MVCFramework;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'type' + sLineBreak +
|
|
|
|
' %1:s = class(TWebModule)' + sLineBreak +
|
|
|
|
' procedure WebModuleCreate(Sender: TObject);' + sLineBreak +
|
|
|
|
' procedure WebModuleDestroy(Sender: TObject);' + sLineBreak +
|
|
|
|
' private' + sLineBreak +
|
|
|
|
' FMVC: TMVCEngine;' + sLineBreak +
|
|
|
|
' public' + sLineBreak +
|
|
|
|
' { Public declarations }' + sLineBreak +
|
|
|
|
' end;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'var' + sLineBreak +
|
|
|
|
' WebModuleClass: TComponentClass = %1:s;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'implementation' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'{$R *.dfm}' + sLineBreak +
|
|
|
|
sLineBreak +
|
2017-09-21 23:11:19 +02:00
|
|
|
'uses %2:s, System.IOUtils, MVCFramework.Commons;' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
sLineBreak +
|
|
|
|
'procedure %1:s.WebModuleCreate(Sender: TObject);' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' FMVC := TMVCEngine.Create(Self,' + sLineBreak +
|
|
|
|
' procedure(Config: TMVCConfig)' + sLineBreak +
|
|
|
|
' begin' + sLineBreak +
|
|
|
|
' //enable static files' + sLineBreak +
|
2017-09-21 23:11:19 +02:00
|
|
|
' Config[TMVCConfigKey.DocumentRoot] := TPath.Combine(ExtractFilePath(GetModuleName(HInstance)), ''www'');'
|
2016-09-20 11:10:40 +02:00
|
|
|
+ sLineBreak +
|
|
|
|
' // session timeout (0 means session cookie)' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.SessionTimeout] := ''0'';' + sLineBreak +
|
|
|
|
' //default content-type' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.DefaultContentType] := TMVCConstants.DEFAULT_CONTENT_TYPE;' +
|
|
|
|
sLineBreak +
|
|
|
|
' //default content charset' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.DefaultContentCharset] := TMVCConstants.DEFAULT_CONTENT_CHARSET;' +
|
|
|
|
sLineBreak +
|
|
|
|
' //unhandled actions are permitted?' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.AllowUnhandledAction] := ''false'';' + sLineBreak +
|
|
|
|
' //default view file extension' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.DefaultViewFileExtension] := ''html'';' + sLineBreak +
|
|
|
|
' //view path' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.ViewPath] := ''templates'';' + sLineBreak +
|
|
|
|
' //Enable Server Signature in response' + sLineBreak +
|
|
|
|
' Config[TMVCConfigKey.ExposeServerSignature] := ''true'';' + sLineBreak +
|
2017-01-18 21:53:53 +01:00
|
|
|
' // Define a default URL for requests that don''t map to a route or a file (useful for client side web app)' +
|
|
|
|
sLineBreak +
|
2016-12-07 12:34:51 +01:00
|
|
|
' Config[TMVCConfigKey.FallbackResource] := ''index.html'';' + sLineBreak +
|
2016-09-20 11:10:40 +02:00
|
|
|
' end);' + sLineBreak +
|
|
|
|
' FMVC.AddController(%3:s);' + sLineBreak +
|
|
|
|
'end;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'procedure %1:s.WebModuleDestroy(Sender: TObject);' + sLineBreak +
|
|
|
|
'begin' + sLineBreak +
|
|
|
|
' FMVC.Free;' + sLineBreak +
|
|
|
|
'end;' + sLineBreak +
|
|
|
|
sLineBreak +
|
|
|
|
'end.' + sLineBreak;
|
2016-02-24 22:37:13 +01:00
|
|
|
|
2016-09-20 11:10:40 +02:00
|
|
|
sWebModuleDFM =
|
|
|
|
'object %0:s: %1:s' + sLineBreak +
|
|
|
|
' OldCreateOrder = False' + sLineBreak +
|
|
|
|
' OnCreate = WebModuleCreate' + sLineBreak +
|
|
|
|
' OnDestroy = WebModuleDestroy' + sLineBreak +
|
|
|
|
' Height = 230' + sLineBreak +
|
|
|
|
' Width = 415' + sLineBreak +
|
|
|
|
'end';
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
end.
|