Skip to content

Commit

Permalink
doc: Update use embedmd (include file in .md)
Browse files Browse the repository at this point in the history
  • Loading branch information
vomnes committed Mar 15, 2021
1 parent ebb0d39 commit 5d1b16d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -56,6 +55,7 @@ func main() {
```

#### Serve embed folder
[embedmd]:# (example/embed/example.go)
```go
package main

Expand All @@ -68,20 +68,20 @@ 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")
})
r.NoRoute(func (c *gin.Context) {
r.NoRoute(func(c *gin.Context) {
fmt.Printf("%s doesn't exists, redirect on /\n", c.Request.URL.Path)
c.Redirect(http.StatusMovedPermanently, "/")
})
// Listen and Server in 0.0.0.0:8080
r.Run(":8080")
}
```
```

0 comments on commit 5d1b16d

Please sign in to comment.