Show HN: FastAPI like controllers for Gin based Go apps(github.com)1 points·by krsoninikhil·2 anni fa·0 commentsgithub.comShow HN: FastAPI like controllers for Gin based Go appshttps://github.com/krsoninikhil/go-rest-kitMotivation: I should be able to write following handler / controller similar to FastAPI by just defining SpecificRequest and SpecificResponse i.e. get request body type as argument and return response type along with error:func myHandler(ctx context.Context, request SpecificRequest) (*SpecificResponse, error) {}Exposing simple CRUD APIs is as simple as following- Ensure your model implements crud.Model, you can embed pgdb.BaseModel to get default implementation for few methods.- Define your request and response types and have them implement crud.Request and crud.Response interfaces.- Add routes specifying your request, response and model types0 commentsPost comment—
func myHandler(ctx context.Context, request SpecificRequest) (*SpecificResponse, error) {}
Exposing simple CRUD APIs is as simple as following
- Ensure your model implements crud.Model, you can embed pgdb.BaseModel to get default implementation for few methods.
- Define your request and response types and have them implement crud.Request and crud.Response interfaces.
- Add routes specifying your request, response and model types