Newer
Older

gjahn
committed
"os"
"fmt"
"net/http"
"webservice/configuration"
func SetRoutes( router *f.App, config *configuration.Config, healthiness *bool ){

gjahn
committed

gjahn
committed
return c.SendString( "Hello, World!" )
router.Get( "/health", func( c *f.Ctx ) error {
type response struct {
c.Set( "Content-Type", "application/health+json; charset=utf-8" )
}
c.Status( http.StatusServiceUnavailable )
} else {
}
c.Status( http.StatusOK )
}
resJson, err := json.Marshal( res )
if err != nil {
return err
}
return c.SendString( string( resJson ) )

gjahn
committed
router.Get( "/env", func( c *f.Ctx ) error {
c.Type( "txt", "utf-8" )
if config.Environment == "production" {
c.Status( http.StatusForbidden )
return nil
}
for _, envVar := range os.Environ() {
_, err := c.WriteString( fmt.Sprintln( envVar ) )
if err != nil {
c.Status( http.StatusInternalServerError )
return err
}
}
c.Status( http.StatusOK )
return nil
})

gjahn
committed
return c.SendStatus( http.StatusTeapot )