https://github.com/karitham/handlergen
Generate helper functions to map handler to concrete types
https://github.com/karitham/handlergen
codegen go golang http
Last synced: 2 months ago
JSON representation
Generate helper functions to map handler to concrete types
- Host: GitHub
- URL: https://github.com/karitham/handlergen
- Owner: karitham
- License: isc
- Created: 2021-06-24T17:03:46.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-28T10:01:44.000Z (over 3 years ago)
- Last Synced: 2025-02-12T09:56:26.167Z (3 months ago)
- Topics: codegen, go, golang, http
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HandlerGen
## Notice
If you happen to stumble on this, it is barely functional, and unmaintained.
My effort goes in favor of , which fullfills my goals and ideas, and has more traction.## Description
A go net/http HandlerFunc code generator.
Parses all your args and give them to you as function arguments,
which you can then validate and use.## Features
Multiple arguments format supported:
- Query URL
- HTTP headers
- Request Body
- URL Path, using go-chiFully net/http complient
Codegen, no slow downs!
## InstallationInstall Handlergen with the go toolchain
```bash
go install github.com/Karitham/handlergen@latest
```## Usage/Examples
Describe the function you want
```yml
functions:
example1:
query:
user_id:
type: int
body:
type: gen.Template
import: github.com/Karitham/handlergen/gen
```and codegen a httphandler
```sh
handlergen -file _example/basic/basic.yaml > _example/basic/generated.go
```**[View more examples](_example)**
## Documentation| flag | default value | description |
| ---- | --------- | ----------- |
| file | handlers.yaml | handlers gen config file |
| format | handlergen | input file format, use `openapi` for an open api file |
| pkg | handlers | package name |## Authors
- [@Karitham](https://www.github.com/Karitham)
## License
[ISC](https://choosealicense.com/licenses/isc/)