Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Go's Gin #96

Merged
merged 1 commit into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ router_cr:
ln -s -f ../crystal/router.cr/bin/server_crystal_router_cr bin/.

# --- Go ---
go: echo gorilla-mux fasthttprouter
go: echo gorilla-mux fasthttprouter gin

# Echo
echo:
Expand All @@ -96,6 +96,11 @@ fasthttprouter:
cd go/fasthttprouter; go build -o server_go_fasthttprouter main.go
ln -s -f ../go/fasthttprouter/server_go_fasthttprouter bin/.

gin:
go get github.com/gin-gonic/gin
cd go/gin; go build -o server_go_gin main.go
ln -s -f ../go/gin/server_go_gin bin/.

# --- Rust ---
rust: iron nickel rocket

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ CPU Cores: 8
- [gorilla-mux](https://github.com/gorilla/mux)
- [iris](https://github.com/kataras/iris)
- [fasthttprouter](https://github.com/buaazp/fasthttprouter)
- [Gin](https://github.com/gin-gonic/gin)
- Rust
- [IRON](https://github.com/iron/iron)
- [nickel.rs](https://github.com/nickel-org/nickel.rs)
Expand Down
26 changes: 26 additions & 0 deletions go/gin/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"net/http"

"github.com/gin-gonic/gin"
)

func main() {
r := gin.Default()

r.GET("/", func(c *gin.Context) {
c.String(http.StatusOK, "")
})

r.GET("/user/:name", func(c *gin.Context) {
name := c.Params.ByName("name")
c.String(http.StatusOK, name)
})

r.POST("/user", func(c *gin.Context) {
c.String(http.StatusOK, "")
})

r.Run(":3000")
}
9 changes: 9 additions & 0 deletions neph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ go:
- gorilla-mux
- fasthttprouter
- iris
- gin

echo:
command: |
Expand Down Expand Up @@ -132,6 +133,14 @@ fasthttprouter:
dir:
go/fasthttprouter

gin:
command: |
go get github.com/gin-gonic/gin
go build -o server_go_gin main.go
ln -s -f ../go/iris/server_go_gin ../../bin/.
dir:
go/gin

rust:
depends_on:
- iron
Expand Down
1 change: 1 addition & 0 deletions tools/src/benchmarker.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ LANGS = [
{name: "gorilla_mux", repo: "gorilla/mux"},
{name: "iris", repo: "kataras/iris"},
{name: "fasthttprouter", repo: "buaazp/fasthttprouter"},
{name: "gin", repo: "gin-gonic/gin"}
]},
{lang: "rust", targets: [
{name: "iron", repo: "iron/iron"},
Expand Down