first commit. working templating, path routing, api responses, web menagment path

This commit is contained in:
2025-10-12 07:05:03 +00:00
commit ebc79583e4
12 changed files with 203 additions and 0 deletions

25
web/web.go Normal file
View File

@ -0,0 +1,25 @@
package web
import (
"api_manager/web/api"
"api_manager/web/manager"
"api_manager/web/render"
"fmt"
"net/http"
)
func Server() {
http.HandleFunc("/", main_page)
http.HandleFunc("/mgr/add", manager.Add_api)
http.HandleFunc("/mgr/show", manager.Show_apis)
http.HandleFunc("/api/", api.Get_api)
http.ListenAndServe(":8090", nil)
}
// wellcoming main web page
func main_page(w http.ResponseWriter, req *http.Request) {
templ := map[string]string{"welcome_message": "hello world! this is api server with easy web menagment"}
fmt.Fprint(w, render.Template_with_page_vars("main", templ))
}