lweb/server_example.pb

64 lines
1.3 KiB
Text
Raw Normal View History

;****************************
;*
;* Lihaso Web Server
;*
2021-05-22 12:09:31 +02:00
;* HTTP/HTTPS example extended Server
;*
2021-04-29 09:41:41 +02:00
;* (c)2015 - 2021 by Linder Hard- und Software
;*
;*
EnableExplicit
;*
2021-05-22 12:09:31 +02:00
;* Includes:
;*
2021-05-21 11:24:35 +02:00
XIncludeFile "lhs_lib/SYS/lhs_log_ext.pbi" ;User for Access Log, Error Access Log, Error Log and maybe more.
XIncludeFile "lweb_header.pbi"
XIncludeFile "lweb.pbi"
2021-05-22 12:09:31 +02:00
;*
;* Variable declaration:
;*
Define counter, v_lweb_srv_stop
2023-03-27 17:38:13 +02:00
Global Accesslog.s, Errorlog.s, Cachelog.s, DebugLog.s
2021-05-22 12:09:31 +02:00
;*
;* Enable extended Logging:
;*
2023-03-27 17:38:13 +02:00
DebugLog = lhs_log_ext::Create("DebugLog")
lhs_log_ext::SetLogFile(DebugLog, "http-s_debug.log")
lhs_log_ext::Init(DebugLog)
lhs_web::set_config(lhs_web::#conf_Debug_logUUID, DebugLog)
;*
;* includes
;*
2023-03-27 17:38:13 +02:00
XIncludeFile "server_example_function.pbi"
;*
2020-12-01 15:39:19 +01:00
;* Start http & https Server
;*
2023-03-27 17:38:13 +02:00
If lhs_web::server_initial("cfg/server_config.xml")
lhs_log_ext::OutL(DebugLog, lhs_log_ext::#Info, "config succesfully loaded.")
Else
2023-03-27 17:38:13 +02:00
lhs_log_ext::OutL(DebugLog, lhs_log_ext::#Error, "config load failed.")
End
EndIf
counter = 0
OpenConsole("Test")
PrintN("Server_Sample and tests")
2020-11-30 10:08:21 +01:00
PrintN("HTTP an Port:"+lhs_web::get_config(lhs_web::#conf_HTTP_port))
PrintN("HTTPS an Port:"+lhs_web::get_config(lhs_web::#conf_HTTPS_Port))
PrintN("Press Enter to Exit")
Input()
2021-05-25 10:05:41 +02:00
lhs_log_ext::StopAllLogger()
2023-03-27 17:38:13 +02:00
lhs_web::server_stop()
2021-05-25 10:05:41 +02:00
PrintN("Finished")
End