lweb/server_example.pb

71 lines
1.6 KiB
Plaintext

;****************************
;*
;* Lihaso Web Server
;*
;* HTTP/HTTPS example extended Server
;*
;* (c)2015 - 2021 by Linder Hard- und Software
;*
;*
EnableExplicit
;*
;* Includes:
;*
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"
;*
;* Variable declaration:
;*
Define counter, v_lweb_srv_stop
Global Accesslog.s, Errorlog.s, Cachelog.s, DebugLog.s
;*
;* Enable extended Logging:
;*
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
;*
XIncludeFile "server_example_function.pbi"
;*
;* Start http & https Server
;*
If lhs_web::server_initial("cfg/server_config.xml")
lhs_log_ext::OutL(DebugLog, lhs_log_ext::#Info, "config succesfully loaded.")
Else
lhs_log_ext::OutL(DebugLog, lhs_log_ext::#Error, "config load failed.")
End
EndIf
;If lhs_web::start_server("Default")
; lhs_log_ext::OutL(DebugLog, lhs_log_ext::#Debugging,"Server gestartet" + lhs_web::get_config(lhs_web::#conf_HTTP_port))
;Else
; lhs_log_ext::OutL(DebugLog, lhs_log_ext::#Debugging,"Fehlgeschlagen")
; End
;EndIf
counter = 0
OpenConsole("Test")
PrintN("Server_Sample and tests")
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()
lhs_log_ext::StopAllLogger()
lhs_web::server_stop()
PrintN("Finished")
End