This commit is contained in:
parent
d4c283e5c4
commit
00177ef1f4
3 changed files with 24 additions and 1 deletions
|
@ -28,11 +28,16 @@ type ImageReference struct {
|
||||||
func init() {
|
func init() {
|
||||||
router := spinhttp.NewRouter()
|
router := spinhttp.NewRouter()
|
||||||
|
|
||||||
router.GET("/monkeyuser", monkeyUserComic)
|
router.GET("/comics/random", randomComic)
|
||||||
|
router.GET("/comics/monkeyuser", monkeyUserComic)
|
||||||
|
|
||||||
spinhttp.Handle(router.ServeHTTP)
|
spinhttp.Handle(router.ServeHTTP)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func randomComic(w http.ResponseWriter, re *http.Request, params httprouter.Params) {
|
||||||
|
monkeyUserComic(w, re, params)
|
||||||
|
}
|
||||||
|
|
||||||
func monkeyUserComic(w http.ResponseWriter, re *http.Request, _ httprouter.Params) {
|
func monkeyUserComic(w http.ResponseWriter, re *http.Request, _ httprouter.Params) {
|
||||||
indexResponse, err := spinhttp.Get("https://www.monkeyuser.com/index.json")
|
indexResponse, err := spinhttp.Get("https://www.monkeyuser.com/index.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,4 +6,5 @@ namespace: functions
|
||||||
resources:
|
resources:
|
||||||
- resources/namespace.yaml
|
- resources/namespace.yaml
|
||||||
- resources/executor.yaml
|
- resources/executor.yaml
|
||||||
|
- resources/routes.yaml
|
||||||
- apps/comics.yaml
|
- apps/comics.yaml
|
||||||
|
|
17
deploy/resources/routes.yaml
Normal file
17
deploy/resources/routes.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
name: functions-https
|
||||||
|
spec:
|
||||||
|
parentRefs:
|
||||||
|
- name: contour
|
||||||
|
sectionName: https
|
||||||
|
namespace: projectcontour
|
||||||
|
hostnames:
|
||||||
|
- "functions.icb4dc0.de"
|
||||||
|
rules:
|
||||||
|
- matches:
|
||||||
|
- path: /comics
|
||||||
|
backendRefs:
|
||||||
|
- name: comics
|
||||||
|
port: 80
|
Loading…
Add table
Reference in a new issue