Skip to content

Commit

Permalink
feat: add info handler on sharedapi
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Dec 16, 2022
1 parent 23e7cd4 commit d43b8d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sharedapi/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/formancehq/go-libs/sharedapi

go 1.19
18 changes: 18 additions & 0 deletions sharedapi/handler_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package sharedapi

import (
"encoding/json"
"net/http"
)

type ServiceInfo struct {
Version string `json:"version"`
}

func InfoHandler(info ServiceInfo) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if err := json.NewEncoder(w).Encode(info); err != nil {
panic(err)
}
}
}

0 comments on commit d43b8d3

Please sign in to comment.