/usr/share/gps/templates/aws_web_server_blocks/src/@_project_name_@-main.adb is in gnat-gps-common 5.0-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | with AWS.Config.Set;
with AWS.Server;
with AWS.Services.Dispatchers.URI;
with AWS.Services.Web_Block.Registry;
with @_Project_Name_@.Dispatchers;
with WBlocks;
procedure @_Project_Name_@.Main is
use AWS;
Web_Server : Server.HTTP;
Web_Config : Config.Object;
Web_Dispatcher : Services.Dispatchers.URI.Handler;
Default_Dispatcher : Dispatchers.Default;
CSS_Dispatcher : Dispatchers.CSS;
JS_Dispatcher : Dispatchers.JS;
Image_Dispatcher : Dispatchers.Image;
begin
-- Setup server
Config.Set.Server_Host (Web_Config, Host);
Config.Set.Server_Port (Web_Config, Port);
-- Setup dispatchers
Dispatchers.Initialize (Web_Config);
Services.Dispatchers.URI.Register
(Web_Dispatcher,
URI => "/css/",
Action => CSS_Dispatcher,
Prefix => True);
Services.Dispatchers.URI.Register
(Web_Dispatcher,
URI => "/js/",
Action => JS_Dispatcher,
Prefix => True);
Services.Dispatchers.URI.Register
(Web_Dispatcher,
URI => "/img/",
Action => Image_Dispatcher,
Prefix => True);
Services.Dispatchers.URI.Register_Default_Callback
(Web_Dispatcher,
Action => Default_Dispatcher);
-- Register Web blocks
WBlocks.Lazy.Register;
-- Register all Web pages
Services.Web_Block.Registry.Register
("/", "tmplt/main.thtml", null);
-- Start the server
Server.Start (Web_Server, Web_Dispatcher, Web_Config);
-- Wait for the Q key
Server.Wait (Server.Q_Key_Pressed);
-- Stop the server
Server.Shutdown (Web_Server);
end @_Project_Name_@.Main;
|