gosora/router_gen/gen_router.go

39 lines
1.2 KiB
Go

// Code generated by. DO NOT EDIT.
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
package main
import "net/http"
type GenRouter struct {
UploadHandler http.Handler
}
func NewGenRouter() *GenRouter {
fs_u := http.FileServer(http.Dir("./uploads"))
return &GenRouter{http.StripPrefix("/uploads/",fs_u).ServeHTTP}
}
func (router *GenRouter) Handle(_ string, _ http.Handler) {
}
func (router *GenRouter) HandleFunc(_ string, _ func(http.ResponseWriter, *http.Request)) {
}
func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
var extra_data string
if req.URL.Path[len(req.URL.Path) - 1] != '/' {
extra_data = req.URL.Path[strings.LastIndexByte(req.URL.Path,'/') + 1:]
req.URL.Path = req.URL.Path[:strings.LastIndexByte(req.URL.Path,'/') + 1]
}
switch(req.URL.Path) {
case "/overview/":
route_overview(w http.ResponseWriter, req *http.Request)
case "/pages/":
route_custom_page(w http.ResponseWriter, req *http.Request, &extra_data)
case "/topics/":
route_topics(w http.ResponseWriter, req *http.Request, &groups, &forums)
case "/uploads/": UploadHandler(w,req)
default: NotFound(w,req)
}
}