26 lines
602 B
Go
26 lines
602 B
Go
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.Render_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))
|
|
}
|