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
{{define "home.html"}} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Boatswain Blog | {{index . "name"}}</title> | |
</head> | |
<body> | |
<h1>{{index . "msg"}}</h1> | |
</body> | |
</html> |
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
package handler | |
import ( | |
"net/http" | |
"github.com/labstack/echo" | |
) | |
func HomeHandler(c echo.Context) error { | |
// Please note the the second parameter "home.html" is the template name and should |
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
package main | |
import ( | |
"html/template" | |
"io" | |
"github.com/labstack/echo" | |
"gitlab.com/ykyuen/golang-echo-template-example/handler" | |
) |
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
golang-echo-template-example/ | |
├── handler/ # folder of request handlers | |
│ └── home_handler.go | |
├── vendor/ # dependencies managed by dep | |
│ ├── github.com/* | |
│ └── golang.org/* | |
├── view/ # folder of html templates | |
│ └── home.html | |
├── Gopkg.lock # dep config file | |
├── Gopkg.toml # dep config file |
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
package main | |
import ( | |
"net/http" | |
"github.com/labstack/echo" | |
) | |
func main() { | |
e := echo.New() |
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
package main | |
import ( | |
"net/http" | |
"github.com/labstack/echo" | |
) | |
func main() { | |
e := echo.New() |
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
package main | |
import ( | |
"net/http" | |
"github.com/labstack/echo" | |
) | |
func main() { | |
e := echo.New() |
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
version: '3.2' | |
services: | |
nginx: | |
image: 'nginx:latest' | |
ports: | |
- '80:80' | |
logging: | |
driver: "json-file" | |
options: | |
max-size: "1k" |
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
$ docker run \ | |
--log-driver json-file \ | |
--log-opt max-size=10m \ | |
--log-opt max-file=10 \ | |
alpine echo hello world |
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
{ | |
"log-driver": "json-file", | |
"log-opts": { | |
"max-size": "10m", | |
"max-file": "10" | |
} | |
} |