diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-13 01:52:16 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-13 01:52:16 +0800 |
commit | b2f5ebdc623c5cf278215ef2da0ecefaba2f5d65 (patch) | |
tree | 08be901cc463e45418e3ffff3d0b3be16ff27f23 /http_server.go | |
parent | _header.html: Add header (diff) | |
download | forge-b2f5ebdc623c5cf278215ef2da0ecefaba2f5d65.tar.gz forge-b2f5ebdc623c5cf278215ef2da0ecefaba2f5d65.tar.zst forge-b2f5ebdc623c5cf278215ef2da0ecefaba2f5d65.zip |
login: Stub login page
Diffstat (limited to 'http_server.go')
-rw-r--r-- | http_server.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/http_server.go b/http_server.go index 4d2d77c..ddbe8ce 100644 --- a/http_server.go +++ b/http_server.go @@ -34,12 +34,11 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { switch segments[1] { case "static": static_handler.ServeHTTP(w, r) + return case "source": source_handler.ServeHTTP(w, r) - default: - http.Error(w, fmt.Sprintf("Unknown system module type: %s", segments[1]), http.StatusNotFound) + return } - return } params := make(map[string]any) @@ -52,6 +51,17 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { params["user_id"] = string(_user_id) } + if segments[0] == ":" { + switch segments[1] { + case "login": + handle_login(w, r, params) + return + default: + http.Error(w, fmt.Sprintf("Unknown system module type: %s", segments[1]), http.StatusNotFound) + return + } + } + fmt.Printf("%#v\n", params) separator_index := -1 |