doc: Update use embedmd (include file in .md)
This commit is contained in:
parent
ebb0d398c3
commit
5d1b16d05b
|
@ -11,7 +11,7 @@ install:
|
|||
- go get github.com/campoy/embedmd
|
||||
|
||||
script:
|
||||
- embedmd -d *.md
|
||||
- embedmd -w *.md
|
||||
- go test -v -covermode=atomic -coverprofile=coverage.out
|
||||
|
||||
after_success:
|
||||
|
|
|
@ -27,9 +27,8 @@ import "github.com/gin-contrib/static"
|
|||
|
||||
See the [example](example)
|
||||
|
||||
[embedmd]:# (example/simple/example.go go)
|
||||
|
||||
#### Serve local file
|
||||
[embedmd]:# (example/simple/example.go)
|
||||
```go
|
||||
package main
|
||||
|
||||
|
@ -56,6 +55,7 @@ func main() {
|
|||
```
|
||||
|
||||
#### Serve embed folder
|
||||
[embedmd]:# (example/embed/example.go)
|
||||
```go
|
||||
package main
|
||||
|
||||
|
@ -68,12 +68,12 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//go:embed tmp/server
|
||||
//go:embed data
|
||||
var server embed.FS
|
||||
|
||||
func main() {
|
||||
r := gin.Default()
|
||||
r.Use(static.Serve("/", static.EmbedFolder(server, "tmp/server")))
|
||||
r.Use(static.Serve("/", static.EmbedFolder(server, "data/server")))
|
||||
r.GET("/ping", func(c *gin.Context) {
|
||||
c.String(200, "test")
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue