Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei authored Jan 6, 2024
1 parent b2406da commit 4b43ca5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,22 @@ yap - Yet Another Go/Go+ HTTP Web Framework
[![GitHub release](https://img.shields.io/github/v/tag/goplus/yap.svg?label=release)](https://github.com/goplus/yap/releases)
[![Coverage Status](https://codecov.io/gh/goplus/yap/branch/main/graph/badge.svg)](https://codecov.io/gh/goplus/yap)
[![GoDoc](https://pkg.go.dev/badge/github.com/goplus/yap.svg)](https://pkg.go.dev/github.com/goplus/yap)

### Router and Parameters

demo ([hello.go](demo/hello/hello.go)):

```go
import "github.com/goplus/yap"

y := yap.New()
y.GET("/p/:id", func(ctx *yap.Context) {
ctx.JSON(200, yap.H{
"id": ctx.Param("id"),
})
})
y.Handle("/", func(ctx *yap.Context) {
ctx.TEXT(200, "text/html", `<html><body>Hello, <a href="/p/123">Yap</a>!</body></html>`)
})
y.Run(":8080")
```

0 comments on commit 4b43ca5

Please sign in to comment.