add initial server implementation

This commit is contained in:
Lera Elvoé
2022-06-21 15:48:14 +03:00
parent ec63dde2b0
commit 6478f54689
4 changed files with 92 additions and 2 deletions

View File

@ -13,7 +13,7 @@ const Status = preload("res://addons/http_server/status.gd")
var __endpoints: Dictionary = {
# key: [Int, String], array with 0 index representing method, 1 index representing endpoint
# value: [FuncRef, Variant], index 0 = reference to function to call, index 1 = binds to pass to func
# value: [FuncRef, Array], index 0 = reference to function to call, index 1 = binds to pass to func
}
var __fallback: FuncRef = null
var __server: TCP_Server = null
@ -21,7 +21,7 @@ var __server: TCP_Server = null
# Public methods
func endpoint(type: int, endpoint: String, function: FuncRef, binds = null) -> void:
func endpoint(type: int, endpoint: String, function: FuncRef, binds: Array = []) -> void:
var endpoint_hash: Array = [type, endpoint]
if endpoint_hash in __endpoints:
print(