frontend: refactor and dispatch in many routes
This commit is contained in:
parent
4fc4e34a4e
commit
6e7e174713
5 changed files with 167 additions and 101 deletions
|
@ -73,7 +73,13 @@ func main() {
|
|||
if *resolutionRoute {
|
||||
http.Handle(fmt.Sprintf("%s/resolution/", *prefix), http.StripPrefix(fmt.Sprintf("%s/resolution/", *prefix), ResolutionHandler{}))
|
||||
}
|
||||
http.Handle(fmt.Sprintf("%s/", *prefix), http.StripPrefix(*prefix, SubmissionHandler{end, *denyChName, *allowRegistration}))
|
||||
if *allowRegistration {
|
||||
http.Handle(fmt.Sprintf("%s/registration", *prefix), http.StripPrefix(fmt.Sprintf("%s/registration", *prefix), RegistrationHandler{}))
|
||||
}
|
||||
if !*denyChName {
|
||||
http.Handle(fmt.Sprintf("%s/chname/", *prefix), http.StripPrefix(fmt.Sprintf("%s/chname/", *prefix), ChNameHandler{}))
|
||||
}
|
||||
http.Handle(fmt.Sprintf("%s/submission/", *prefix), http.StripPrefix(fmt.Sprintf("%s/submission/", *prefix), SubmissionHandler{end}))
|
||||
|
||||
log.Println(fmt.Sprintf("Ready, listening on %s", *bind))
|
||||
if err := http.ListenAndServe(*bind, nil); err != nil {
|
||||
|
|
Reference in a new issue