diff --git a/echo.go b/echo.go index c29b1c3d..7232d65e 100644 --- a/echo.go +++ b/echo.go @@ -462,11 +462,13 @@ func (e *Echo) Routes() []Route { // ServeHTTP implements `http.Handler` interface, which serves HTTP requests. func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) { + println(r.Method) c := e.pool.Get().(*Context) h, echo := e.router.Find(r.Method, r.URL.Path, c) if echo != nil { e = echo } + println(echo) c.reset(r, w, e) // Chain middleware with handler in the end diff --git a/website/Makefile b/website/Makefile new file mode 100644 index 00000000..0a3fb293 --- /dev/null +++ b/website/Makefile @@ -0,0 +1,17 @@ +.PHONY: build push deploy + +NAME := echo +TAG := $(shell date +'%Y.%m.%dT%H.%M') + +build: + rm -rf public + hugo + gox -osarch=linux/amd64 -output server + docker build -t gcr.io/$(PROJECT_ID)/$(NAME):$(TAG) . + +push: build + gcloud docker push gcr.io/$(PROJECT_ID)/$(NAME):$(TAG) + +deploy: push + # https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/user-guide/kubectl/kubectl_rolling-update.md + kubectl rolling-update $(NAME) --image=gcr.io/$(PROJECT_ID)/$(NAME):$(TAG) diff --git a/website/content/guide/customization.md b/website/content/guide/customization.md index 12e56bcf..ca87257c 100644 --- a/website/content/guide/customization.md +++ b/website/content/guide/customization.md @@ -3,7 +3,7 @@ title: Customization menu: main: parent: guide - weight: 20 + weight: 2 --- ### HTTP error handler diff --git a/website/content/guide/error-handling.md b/website/content/guide/error-handling.md index 3649d313..e629e09b 100644 --- a/website/content/guide/error-handling.md +++ b/website/content/guide/error-handling.md @@ -3,7 +3,7 @@ title: Error Handling menu: main: parent: guide - weight: 70 + weight: 7 --- Echo advocates centralized HTTP error handling by returning `error` from middleware diff --git a/website/content/guide/installation.md b/website/content/guide/installation.md index 0711b790..688aca44 100644 --- a/website/content/guide/installation.md +++ b/website/content/guide/installation.md @@ -3,7 +3,7 @@ title: Installation menu: main: parent: guide - weight: 10 + weight: 1 --- Echo has been developed and tested using Go `1.4.x` diff --git a/website/content/guide/middleware.md b/website/content/guide/middleware.md index d8117d15..eeeec813 100644 --- a/website/content/guide/middleware.md +++ b/website/content/guide/middleware.md @@ -3,7 +3,7 @@ title: Middleware menu: main: parent: guide - weight: 40 + weight: 4 --- Middleware is a function which is chained in the HTTP request-response cycle. Middleware diff --git a/website/content/guide/request.md b/website/content/guide/request.md index 92d4849f..76251094 100644 --- a/website/content/guide/request.md +++ b/website/content/guide/request.md @@ -3,7 +3,7 @@ title: Request menu: main: parent: guide - weight: 50 + weight: 5 --- ### Path parameter diff --git a/website/content/guide/response.md b/website/content/guide/response.md index 7f0870f1..3a62f57e 100644 --- a/website/content/guide/response.md +++ b/website/content/guide/response.md @@ -3,7 +3,7 @@ title: Response menu: main: parent: guide - weight: 60 + weight: 6 --- ### Template diff --git a/website/content/guide/routing.md b/website/content/guide/routing.md index ca7a95c9..840b59e0 100644 --- a/website/content/guide/routing.md +++ b/website/content/guide/routing.md @@ -3,7 +3,7 @@ title: Routing menu: main: parent: guide - weight: 30 + weight: 3 --- Echo's router is [fast, optimized]({{< relref "index.md#performance">}}) and diff --git a/website/layouts/_default/single.html b/website/layouts/_default/single.html index c169e9f1..407ba1cd 100644 --- a/website/layouts/_default/single.html +++ b/website/layouts/_default/single.html @@ -37,8 +37,8 @@ + {{ partial "footer.html" . }} - {{ partial "footer.html" . }} diff --git a/website/layouts/index.html b/website/layouts/index.html index c6bbc625..6feb84ab 100644 --- a/website/layouts/index.html +++ b/website/layouts/index.html @@ -16,8 +16,8 @@ + {{ partial "footer.html" . }} - {{ partial "footer.html" . }} diff --git a/website/layouts/partials/footer.html b/website/layouts/partials/footer.html index 955dc48d..b9065a5e 100644 --- a/website/layouts/partials/footer.html +++ b/website/layouts/partials/footer.html @@ -28,6 +28,7 @@ + diff --git a/website/rc.json b/website/rc.json new file mode 100644 index 00000000..c75e43a7 --- /dev/null +++ b/website/rc.json @@ -0,0 +1,29 @@ +{ + "apiVersion": "v1", + "kind": "ReplicationController", + "metadata": { + "name": "echo" + }, + "spec": { + "replicas": 2, + "selector": { + "name": "echo" + }, + "template": { + "metadata": { + "labels": { + "name": "echo" + } + }, + "spec": { + "containers": [{ + "image": "gcr.io/fluent-anagram-95603/echo", + "name": "echo", + "ports": [{ + "containerPort": 5091 + }] + }] + } + } + } +} diff --git a/website/service.json b/website/service.json new file mode 100644 index 00000000..970e8660 --- /dev/null +++ b/website/service.json @@ -0,0 +1,18 @@ +{ + "apiVersion": "v1", + "kind": "Service", + "metadata": { + "name": "echo", + "labels": { + "name": "echo" + } + }, + "spec": { + "ports": [{ + "port": 5091 + }], + "selector": { + "name": "echo" + } + } +} diff --git a/website/static/scripts/echo.js b/website/static/scripts/echo.js new file mode 100644 index 00000000..d195dcb2 --- /dev/null +++ b/website/static/scripts/echo.js @@ -0,0 +1,10 @@ +(function() { + var menu = document.querySelectorAll('.menu a'); + + for (var i = 0; i < menu.length; i++) { + var m = menu[i]; + if (location.href === m.href) { + m.className += 'active'; + } + } +})(); diff --git a/website/static/styles/echo.css b/website/static/styles/echo.css index 2c43ba25..d1dacab3 100644 --- a/website/static/styles/echo.css +++ b/website/static/styles/echo.css @@ -1,5 +1,4 @@ footer { - padding: 40px 80px !important; background-color: inherit !important; border-top: 2px solid #E0E0E0; } @@ -16,11 +15,13 @@ footer { color: #333; } code { - font-size: .95em; padding: 2px 4px; - background: #eee; + background: #EEE; color: #424242; + font-size: .95em; font-family: Source Code Pro, Monaco, Menlo, Consolas, monospace; + border: 1px solid #BDBDBD; + border-radius: 4px; } a:link { text-decoration: none; @@ -36,5 +37,13 @@ a:link { .menu a { display: block; color: #757575; - padding: 2px 0 + padding: 5px; + border-left:2px #F06292 solid; +} +.menu a:hover { + background-color: #E0E0E0; +} +.menu .active { + color: #FFF; + background-color: #F06292; }