first commit. working templating, path routing, api responses, web menagment path
This commit is contained in:
25
web/web.go
Normal file
25
web/web.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user