-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a teapot and improved problem responses
- Loading branch information
1 parent
731653f
commit 33b0c15
Showing
5 changed files
with
64 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package teapot | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/NeuralNexusDev/neuralnexus-api/responses" | ||
) | ||
|
||
// -------------- Routes -------------- | ||
|
||
// ApplyRoutes - Apply the routes | ||
func ApplyRoutes(mux, authedMux *http.ServeMux) (*http.ServeMux, *http.ServeMux) { | ||
mux.HandleFunc("GET /teapot", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
responses.NewProblemResponse( | ||
"about:blank", | ||
http.StatusTeapot, | ||
"I'm a teapot", | ||
"I'm a little teapot, short and stout\nHere is my handle, here is my spout\n", | ||
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418", | ||
).SendAndEncodeProblem(w, r) | ||
})) | ||
return mux, authedMux | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters