https://github.com/codemicro/mercury
A framework for writing Go applications using the Gemini protocol
https://github.com/codemicro/mercury
Last synced: about 1 month ago
JSON representation
A framework for writing Go applications using the Gemini protocol
- Host: GitHub
- URL: https://github.com/codemicro/mercury
- Owner: codemicro
- License: mit
- Created: 2022-05-20T21:01:20.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-27T10:15:57.000Z (about 4 years ago)
- Last Synced: 2025-10-13T14:23:10.019Z (8 months ago)
- Language: Go
- Homepage:
- Size: 74.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mercury
*A framework for writing Go applications using the Gemini protocol*
[](https://pkg.go.dev/github.com/codemicro/mercury) [](https://goreportcard.com/report/github.com/codemicro/mercury)
---
Mercury is a simple framework that lets you build internat applications that make use of [the Gemini protocol](https://gemini.circumlunar.space/) in Golang.
## Features
* Middleware
* URL parameters
* Full Gemini v0.16.1 support
## Example
```go
func run() error {
app, err := mercury.New(
mercury.WithX509KeyPair("cert.pem", "key.pem"),
)
if err != nil {
return err
}
app.Add("/hello", func(ctx *mercury.Ctx) error {
ctx.SetBody("Hello world!")
return nil
})
app.Add("/hello/:name", func(ctx *mercury.Ctx) error {
var sb strings.Builder
ctx.SetBodyBuilder(&sb)
sb.WriteString("Hello ")
sb.WriteString(ctx.GetURLParam("name"))
sb.WriteRune('!')
return nil
})
shutdownChan := make(chan os.Signal)
signal.Notify(shutdownChan, syscall.SIGINT)
go func() {
<-shutdownChan
_ = app.Shutdown()
}()
return app.Listen(":1965")
}
```

## Install
```
go get github.com/codemicro/mercury
```
## This is quite young
This package is still in its early phases. It's probably okay to use, because honestly you're not doing anything aside from hobby projects with Gemini, but if you run into issues or weird behaviour from Mercury, try checking for new updates before much else.
## Footnotes
Issues and pull requests are welcome, though if you're going to do a lot of work for a pull request, please open an issue or discussion to talk it over first.
The API of this package is inspired by that of [Fiber](https://github.com/gofiber/fiber).
This project is licensed under the MIT license. See [LICENSE](LICENSE) for more information.