Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fernandocelmer/api.go
API.go
https://github.com/fernandocelmer/api.go
api apigo go go-api go-package golang
Last synced: about 1 month ago
JSON representation
API.go
- Host: GitHub
- URL: https://github.com/fernandocelmer/api.go
- Owner: FernandoCelmer
- License: mit
- Created: 2024-02-24T20:09:21.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-03-04T02:31:38.000Z (10 months ago)
- Last Synced: 2024-10-15T01:52:03.509Z (3 months ago)
- Topics: api, apigo, go, go-api, go-package, golang
- Language: Go
- Homepage: https://fernandocelmer.github.io/api.go/
- Size: 2.65 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# api.go
---
- **Github**: [https://github.com/FernandoCelmer/api.go](https://github.com/FernandoCelmer/api.go)
- **Documentation**: [https://fernandocelmer.github.io/api.go](https://fernandocelmer.github.io/api.go)
- **Go Package**: [https://pkg.go.dev/github.com/FernandoCelmer/api.go/src](https://pkg.go.dev/github.com/FernandoCelmer/api.go/src)---
## Installation
To install, simply run:
```shell
go get github.com/FernandoCelmer/api.go
```## Required imports
```go
package mainimport (
"encoding/json"
"fmt"
"net/http"web "github.com/FernandoCelmer/api.go/src"
)
```## Simple Example
```go
func main() {
app := web.NewApp()
app.Get("/item", itemHandler)app.Run()
}
```## Example with parameters
```go
func main() {
app := web.NewApp(
web.Title("API"),
web.Description("Minimalist API Test"),
web.Version("0.1.0"),
)app.Get("/item", itemHandler)
app.Run(
web.Host("127.0.0.5"),
web.Port(8080),
)
}
```## Handler implementation
```go
type Response struct {
Message string `json:"message"`
}func itemHandler(w http.ResponseWriter, r *http.Request) {
data := Response{Message: "Item"}
response, _ := json.Marshal(data)
fmt.Fprintf(w, string(response))
}
```## Commit Style
- ⚙️ FEATURE
- 📝 PEP8
- 📌 ISSUE
- 🪲 BUG
- 📘 DOCS
- 📦 PyPI
- ❤️️ TEST
- ⬆️ CI/CD
- ⚠️ SECURITY## License
This project is licensed under the terms of the MIT license.