Skip to content

Commit

Permalink
feat: Handle /
Browse files Browse the repository at this point in the history
  • Loading branch information
iamd3vil committed Apr 6, 2022
1 parent eb955d9 commit c251684
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func main() {
}

g := fastglue.New()
g.GET("/", handleIndex())
g.POST("/{script}", handleExecuteScript(ko.String("script_folder")))

s := &fasthttp.Server{
Expand All @@ -52,6 +53,14 @@ func main() {
}
}

func handleIndex() fastglue.FastRequestHandler {
return func(r *fastglue.Request) error {
r.RequestCtx.WriteString("Hello from http-script-executor.")
r.RequestCtx.SetStatusCode(fasthttp.StatusOK)
return nil
}
}

func handleExecuteScript(scripts string) fastglue.FastRequestHandler {
return func(r *fastglue.Request) error {
script := r.RequestCtx.UserValue("script").(string)
Expand Down

0 comments on commit c251684

Please sign in to comment.