mirror of
https://github.com/labstack/echo.git
synced 2024-11-28 08:38:39 +02:00
Updated docs
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
e45f310607
commit
1efe837fdd
2
echo.go
2
echo.go
@ -462,11 +462,13 @@ func (e *Echo) Routes() []Route {
|
|||||||
|
|
||||||
// ServeHTTP implements `http.Handler` interface, which serves HTTP requests.
|
// ServeHTTP implements `http.Handler` interface, which serves HTTP requests.
|
||||||
func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
println(r.Method)
|
||||||
c := e.pool.Get().(*Context)
|
c := e.pool.Get().(*Context)
|
||||||
h, echo := e.router.Find(r.Method, r.URL.Path, c)
|
h, echo := e.router.Find(r.Method, r.URL.Path, c)
|
||||||
if echo != nil {
|
if echo != nil {
|
||||||
e = echo
|
e = echo
|
||||||
}
|
}
|
||||||
|
println(echo)
|
||||||
c.reset(r, w, e)
|
c.reset(r, w, e)
|
||||||
|
|
||||||
// Chain middleware with handler in the end
|
// Chain middleware with handler in the end
|
||||||
|
17
website/Makefile
Normal file
17
website/Makefile
Normal file
@ -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)
|
@ -3,7 +3,7 @@ title: Customization
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 20
|
weight: 2
|
||||||
---
|
---
|
||||||
|
|
||||||
### HTTP error handler
|
### HTTP error handler
|
||||||
|
@ -3,7 +3,7 @@ title: Error Handling
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 70
|
weight: 7
|
||||||
---
|
---
|
||||||
|
|
||||||
Echo advocates centralized HTTP error handling by returning `error` from middleware
|
Echo advocates centralized HTTP error handling by returning `error` from middleware
|
||||||
|
@ -3,7 +3,7 @@ title: Installation
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 10
|
weight: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
Echo has been developed and tested using Go `1.4.x`
|
Echo has been developed and tested using Go `1.4.x`
|
||||||
|
@ -3,7 +3,7 @@ title: Middleware
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 40
|
weight: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
Middleware is a function which is chained in the HTTP request-response cycle. Middleware
|
Middleware is a function which is chained in the HTTP request-response cycle. Middleware
|
||||||
|
@ -3,7 +3,7 @@ title: Request
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 50
|
weight: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
### Path parameter
|
### Path parameter
|
||||||
|
@ -3,7 +3,7 @@ title: Response
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 60
|
weight: 6
|
||||||
---
|
---
|
||||||
|
|
||||||
### Template
|
### Template
|
||||||
|
@ -3,7 +3,7 @@ title: Routing
|
|||||||
menu:
|
menu:
|
||||||
main:
|
main:
|
||||||
parent: guide
|
parent: guide
|
||||||
weight: 30
|
weight: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
Echo's router is [fast, optimized]({{< relref "index.md#performance">}}) and
|
Echo's router is [fast, optimized]({{< relref "index.md#performance">}}) and
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ partial "footer.html" . }}
|
||||||
</main>
|
</main>
|
||||||
{{ partial "footer.html" . }}
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ partial "footer.html" . }}
|
||||||
</main>
|
</main>
|
||||||
{{ partial "footer.html" . }}
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="/scripts/highlight.pack.min.js"></script>
|
<script src="/scripts/highlight.pack.min.js"></script>
|
||||||
|
<script src="/scripts/echo.js"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script>
|
<script>
|
||||||
(function(i, s, o, g, r, a, m) {
|
(function(i, s, o, g, r, a, m) {
|
||||||
|
@ -18,4 +18,5 @@
|
|||||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="/styles/monokai.css">
|
<link rel="stylesheet" href="/styles/monokai.css">
|
||||||
<link rel="stylesheet" href="/styles/echo.css">
|
<link rel="stylesheet" href="/styles/echo.css">
|
||||||
|
<script src="//storage.googleapis.com/code.getmdl.io/1.0.5/material.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
29
website/rc.json
Normal file
29
website/rc.json
Normal file
@ -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
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
website/service.json
Normal file
18
website/service.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"kind": "Service",
|
||||||
|
"metadata": {
|
||||||
|
"name": "echo",
|
||||||
|
"labels": {
|
||||||
|
"name": "echo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [{
|
||||||
|
"port": 5091
|
||||||
|
}],
|
||||||
|
"selector": {
|
||||||
|
"name": "echo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
website/static/scripts/echo.js
Normal file
10
website/static/scripts/echo.js
Normal file
@ -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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -1,5 +1,4 @@
|
|||||||
footer {
|
footer {
|
||||||
padding: 40px 80px !important;
|
|
||||||
background-color: inherit !important;
|
background-color: inherit !important;
|
||||||
border-top: 2px solid #E0E0E0;
|
border-top: 2px solid #E0E0E0;
|
||||||
}
|
}
|
||||||
@ -16,11 +15,13 @@ footer {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
code {
|
code {
|
||||||
font-size: .95em;
|
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
background: #eee;
|
background: #EEE;
|
||||||
color: #424242;
|
color: #424242;
|
||||||
|
font-size: .95em;
|
||||||
font-family: Source Code Pro, Monaco, Menlo, Consolas, monospace;
|
font-family: Source Code Pro, Monaco, Menlo, Consolas, monospace;
|
||||||
|
border: 1px solid #BDBDBD;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
a:link {
|
a:link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -36,5 +37,13 @@ a:link {
|
|||||||
.menu a {
|
.menu a {
|
||||||
display: block;
|
display: block;
|
||||||
color: #757575;
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user