mirror of
https://codeberg.org/scip/anydb.git
synced 2026-02-04 09:20:58 +01:00
replace fiber with http.ServeMux
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright © 2024 Thomas von Dein
|
||||
Copyright © 2024-2025 Thomas von Dein
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -36,15 +36,16 @@ func Runserver(conf *cfg.Config, args []string) error {
|
||||
// setup api server
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) {
|
||||
// just in case someone tries to access the non-api url
|
||||
mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) {
|
||||
Home(w)
|
||||
})
|
||||
|
||||
mux.HandleFunc("GET "+apiprefix, func(w http.ResponseWriter, r *http.Request) {
|
||||
mux.HandleFunc("GET "+apiprefix+"{$}", func(w http.ResponseWriter, r *http.Request) {
|
||||
RestList(w, r, conf)
|
||||
})
|
||||
|
||||
mux.HandleFunc("POST "+apiprefix, func(w http.ResponseWriter, r *http.Request) {
|
||||
mux.HandleFunc("POST "+apiprefix+"{$}", func(w http.ResponseWriter, r *http.Request) {
|
||||
RestList(w, r, conf)
|
||||
})
|
||||
|
||||
@@ -59,7 +60,7 @@ func Runserver(conf *cfg.Config, args []string) error {
|
||||
})
|
||||
|
||||
mux.HandleFunc("PUT "+apiprefix, func(w http.ResponseWriter, r *http.Request) {
|
||||
RestList(w, r, conf)
|
||||
RestSet(w, r, conf)
|
||||
})
|
||||
|
||||
logger := LogHandler()
|
||||
|
||||
Reference in New Issue
Block a user