Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to provide REST API and documentation #36

Open
yunkon-kim opened this issue Dec 4, 2023 · 1 comment · Fixed by #38 or #41
Open

Improvements to provide REST API and documentation #36

yunkon-kim opened this issue Dec 4, 2023 · 1 comment · Fixed by #38 or #41
Labels
enhancement New feature or request

Comments

@yunkon-kim
Copy link
Member

What is being discussed:

  • necessity of form tag: this is currently needed for migration-related functions.
  • separating credential-related features or settings
  • Distinguishing between calling a web page and calling a REST API
@yunkon-kim yunkon-kim added the enhancement New feature or request label Dec 4, 2023
@yunkon-kim
Copy link
Member Author

그리고, Request/response body를 구조체로 만들어야할 필요가 있습니다. 만들어진 구조체로 기존 map[string]interface{} 형태의 리턴을 대체하려고 합니다.

또한, 만들어진 구조체는 별도의 models package로 묶으면 좋을 것 같습니다.

아래 예시를 참고하시기 바랍니다.

(As-Is)

return ctx.JSON(http.StatusBadRequest, map[string]interface{}{
	"Result": logstrings.String(),
	"Error":  nil,
}

(To-Be)

type BasicReponse struct{
	Result string `"json:"Result"`
	Error *string `"json:"Error"`
}
return ctx.JSON(http.StatusBadRequest, models.BasicReponse{
	Result: logstrings.String(),
	Error:  nil,
}

Note - nil 리턴 여부에 따라 멤버 데이터 타입이 달라 질 수 있고, json naming convention을 전체적으로 맞출 필요가 있어보입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant