Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Morgan | 7,363 | 247,396 | 8,170 | a month ago | 26 | March 20, 2020 | 25 | mit | JavaScript | |
HTTP request logger middleware for node.js | ||||||||||
Netfox | 3,400 | 19 | 2 months ago | 42 | February 11, 2020 | 31 | mit | Swift | ||
A lightweight, one line setup, iOS / OSX network debugging library! 🦊 | ||||||||||
Martian | 1,824 | 1,863 | 313 | 24 days ago | 9 | March 15, 2022 | 42 | apache-2.0 | Go | |
Martian is a library for building custom HTTP/S proxies | ||||||||||
Node Http2 | 1,768 | 8,863 | 184 | 4 years ago | 44 | September 21, 2017 | 75 | mit | JavaScript | |
An HTTP/2 client and server implementation for node.js | ||||||||||
Logbook | 1,297 | 24 | 8 | 16 hours ago | 79 | October 12, 2021 | 59 | mit | Java | |
An extensible Java library for HTTP request and response logging | ||||||||||
Pyzabbix | 873 | 271 | 14 | 5 months ago | 13 | June 23, 2021 | 6 | Python | ||
Python Zabbix API | ||||||||||
Httplog | 750 | 356 | 36 | 12 days ago | 54 | May 20, 2021 | 8 | mit | Ruby | |
Log outgoing HTTP requests in ruby | ||||||||||
Gear | 545 | 11 | 10 | 2 months ago | 155 | June 30, 2022 | mit | Go | ||
A lightweight, composable and high performance web service framework for Go. | ||||||||||
Laravel Http Logger | 520 | 12 | 4 | 2 months ago | 18 | June 07, 2022 | mit | PHP | ||
Log HTTP requests in Laravel applications | ||||||||||
Concurrency Logger | 399 | 17 | 1 | 5 years ago | 4 | March 08, 2018 | 2 | mit | JavaScript | |
Log HTTP requests/responses separately, visualize their concurrency and report logs/errors in context of a request. |
A lightweight, composable and high performance web service framework for Go.
// package gear
import "github.com/teambition/gear"
https://github.com/teambition/gear/tree/master/example/hello
app := gear.New()
// Add logging middleware
app.UseHandler(logging.Default(true))
// Add router middleware
router := gear.NewRouter()
// try: http://127.0.0.1:3000/hello
router.Get("/hello", func(ctx *gear.Context) error {
return ctx.HTML(200, "<h1>Hello, Gear!</h1>")
})
// try: http://127.0.0.1:3000/test?query=hello
router.Otherwise(func(ctx *gear.Context) error {
return ctx.JSON(200, map[string]any{
"Host": ctx.Host,
"Method": ctx.Method,
"Path": ctx.Path,
"URI": ctx.Req.RequestURI,
"Headers": ctx.Req.Header,
})
})
app.UseHandler(router)
app.Error(app.Listen(":3000"))
https://github.com/teambition/gear/tree/master/example/http2
package main
import (
"net/http"
"github.com/teambition/gear"
"github.com/teambition/gear/logging"
"github.com/teambition/gear/middleware/favicon"
)
// go run example/http2/app.go
// Visit: https://127.0.0.1:3000/
func main() {
const htmlBody = `
<!DOCTYPE html>
<html>
<head>
<link href="/hello.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Hello, Gear!</h1>
</body>
</html>`
const pushBody = `
h1 {
color: red;
}
`
app := gear.New()
app.UseHandler(logging.Default(true))
app.Use(favicon.New("./testdata/favicon.ico"))
router := gear.NewRouter()
router.Get("/", func(ctx *gear.Context) error {
ctx.Res.Push("/hello.css", &http.PushOptions{Method: "GET"})
return ctx.HTML(200, htmlBody)
})
router.Get("/hello.css", func(ctx *gear.Context) error {
ctx.Type("text/css")
return ctx.End(200, []byte(pushBody))
})
app.UseHandler(router)
app.Error(app.ListenTLS(":3000", "./testdata/out/test.crt", "./testdata/out/test.key"))
}
https://github.com/teambition/gear/tree/master/example/staticgo
Install it with go:
go install github.com/teambition/gear/example/staticgo
It is a useful CMD tool that serve your local files as web server (support TLS).
You can build osx
, linux
, windows
version with make build
.
package main
import (
"flag"
"github.com/teambition/gear"
"github.com/teambition/gear/logging"
"github.com/teambition/gear/middleware/cors"
"github.com/teambition/gear/middleware/static"
)
var (
address = flag.String("addr", "127.0.0.1:3000", `address to listen on.`)
path = flag.String("path", "./", `static files path to serve.`)
certFile = flag.String("certFile", "", `certFile path, used to create TLS static server.`)
keyFile = flag.String("keyFile", "", `keyFile path, used to create TLS static server.`)
)
func main() {
flag.Parse()
app := gear.New()
app.UseHandler(logging.Default(true))
app.Use(cors.New())
app.Use(static.New(static.Options{Root: *path}))
logging.Println("staticgo v1.1.0, created by https://github.com/teambition/gear")
logging.Printf("listen: %s, serve: %s\n", *address, *path)
if *certFile != "" && *keyFile != "" {
app.Error(app.ListenTLS(*address, *certFile, *keyFile))
} else {
app.Error(app.Listen(*address))
}
}
https://github.com/teambition/gear/tree/master/example/grpc_server
https://github.com/teambition/gear/tree/master/example/grpc_client
gear.Router is a trie base HTTP request handler. Features:
405 Method Not Allowed
OPTIONS
methodThe registered path, against which the router matches incoming requests, can contain six types of parameters:
Syntax | Description |
---|---|
:name |
named parameter |
:name(regexp) |
named with regexp parameter |
:name+suffix |
named parameter with suffix matching |
:name(regexp)+suffix |
named with regexp parameter and suffix matching |
:name* |
named with catch-all parameter |
::name |
not named parameter, it is literal :name
|
Named parameters are dynamic path segments. They match anything until the next '/' or the path end:
Defined: /api/:type/:ID
/api/user/123 matched: type="user", ID="123"
/api/user no match
/api/user/123/comments no match
Named with regexp parameters match anything using regexp until the next '/' or the path end:
Defined: /api/:type/:ID(^\d+$)
/api/user/123 matched: type="user", ID="123"
/api/user no match
/api/user/abc no match
/api/user/123/comments no match
Named parameters with suffix, such as Google API Design:
Defined: /api/:resource/:ID+:undelete
/api/file/123 no match
/api/file/123:undelete matched: resource="file", ID="123"
/api/file/123:undelete/comments no match
Named with regexp parameters and suffix:
Defined: /api/:resource/:ID(^\d+$)+:cancel
/api/task/123 no match
/api/task/123:cancel matched: resource="task", ID="123"
/api/task/abc:cancel no match
Named with catch-all parameters match anything until the path end, including the directory index (the '/' before the catch-all). Since they match anything until the end, catch-all parameters must always be the final path element.
Defined: /files/:filepath*
/files no match
/files/LICENSE matched: filepath="LICENSE"
/files/templates/article.html matched: filepath="templates/article.html"
The value of parameters is saved on the Matched.Params
. Retrieve the value of a parameter by name:
type := matched.Params("type")
id := matched.Params("ID")
Gear is licensed under the MIT license. Copyright © 2016-2023 Teambition.