Skip to content

Commit

Permalink
Rename some functions in pokerogue-server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
patapancakes committed Apr 19, 2024
1 parent 3ea046d commit 57c9100
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pokerogue-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/valyala/fasthttp"
)

var fileserver fasthttp.RequestHandler
var serveStaticContent fasthttp.RequestHandler

func main() {
// flag stuff
Expand Down Expand Up @@ -39,21 +39,21 @@ func main() {
}

// start web server
serveStaticContent = fasthttp.FSHandler(*wwwpath, 0)

api.Init()

fileserver = fasthttp.FSHandler(*wwwpath, 0)

if *tlscert != "" && *tlskey != "" {
err = fasthttp.ListenAndServeTLS(*addr, *tlscert, *tlskey, backend)
err = fasthttp.ListenAndServeTLS(*addr, *tlscert, *tlskey, serve)
} else {
err = fasthttp.ListenAndServe(*addr, backend)
err = fasthttp.ListenAndServe(*addr, serve)
}
if err != nil {
log.Fatalf("failed to create http server or server errored: %s", err)
}
}

func backend(ctx *fasthttp.RequestCtx) {
func serve(ctx *fasthttp.RequestCtx) {
if strings.HasPrefix(string(ctx.Path()), "/api") {
switch string(ctx.Path()) {
case "/api/account/info":
Expand Down Expand Up @@ -86,5 +86,5 @@ func backend(ctx *fasthttp.RequestCtx) {
return
}

fileserver(ctx)
serveStaticContent(ctx)
}

0 comments on commit 57c9100

Please sign in to comment.