https://github.com/nlowe/autojson
http.HandlerFunc wrapper for json-based API's
https://github.com/nlowe/autojson
api go golang json
Last synced: 5 months ago
JSON representation
http.HandlerFunc wrapper for json-based API's
- Host: GitHub
- URL: https://github.com/nlowe/autojson
- Owner: nlowe
- License: mit
- Created: 2019-07-26T20:17:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-01T20:46:54.000Z (almost 7 years ago)
- Last Synced: 2024-06-20T15:44:58.137Z (almost 2 years ago)
- Topics: api, go, golang, json
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# autojson
[](https://travis-ci.org/nlowe/autojson) [](https://coveralls.io/github/nlowe/autojson?branch=master) [](https://goreportcard.com/report/github.com/nlowe/autojson) [](https://godoc.org/github.com/nlowe/autojson)
`autojson` makes it easier to return JSON responses and errors for APIs.
## Usage
To add `autojson` to your project, simply `go get` it:
```bash
go get -u github.com/nlowe/autojson
```
`autojson` accepts a wide variety of handler functions. See the [godoc](https://godoc.org/github.com/nlowe/autojson#HandlerFunc)
for details. In general, your handlers now return concrete types and an optional HTTP Status Code and/or error,
`autojson` takes care of the serialization. See the [example](./sample/main.go) for more details.
## Building
This project makes use of Go Modules. You need Go 1.12+ to fully utilize it.
## License
`autojson` is licensed under the MIT License. It is inspired by the AWS Lambda Go SDK, which is licensed under the
Apache 2 License and can be found at https://github.com/aws/aws-lambda-go.