-
Notifications
You must be signed in to change notification settings - Fork 0
회사들 리스트 조회 api 추가 & 테스트 db config설정 #13
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
501aa5f
fix: 잘못된 에러 출력 수정
pilyang 8ff00ce
refactor: router설정, handler 분리
pilyang cdb2521
refactor: 서버 설정메서드 분리
pilyang 1e7d0ec
feat: company 정보들 제공 api 추가
pilyang 662782d
refactor: config 불러오는 코드 위치 변경
pilyang 32ac73b
test: 테스트용 config생성 추가
pilyang b5f3161
refactor: CompanyListResponse struct 추가
pilyang b86a8e5
test: company handler테스트 추가
pilyang a7f0999
refactor: rename ping handler
pilyang 1bacbee
test: transactional test 유틸 함수 작성
pilyang 8e196a6
test: company list테스트에 transactionalTest func 적용
pilyang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import ( | |
| "github.com/techbloghub/server/config" | ||
| _ "github.com/techbloghub/server/ent/runtime" | ||
| "github.com/techbloghub/server/internal/database" | ||
| "github.com/techbloghub/server/internal/http/router" | ||
|
|
||
| "github.com/gin-gonic/gin" | ||
| _ "github.com/lib/pq" | ||
|
|
@@ -26,18 +27,11 @@ func main() { | |
| defer client.Close() | ||
|
|
||
| // 서버 실행 | ||
| r := setRouter() | ||
| r := gin.Default() | ||
| router.InitRouter(r) | ||
| routerErr := r.Run(":" + cfg.ServerConfig.Port) | ||
| if routerErr != nil { | ||
| fmt.Println("Error while running server: ", routerErr) | ||
|
||
| return | ||
| } | ||
| } | ||
|
|
||
| func setRouter() *gin.Engine { | ||
| r := gin.Default() | ||
| r.GET("/ping", func(context *gin.Context) { | ||
| context.String(200, "pong") | ||
| }) | ||
| return r | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package handler | ||
|
|
||
| import "github.com/gin-gonic/gin" | ||
|
|
||
| func PingPong(context *gin.Context) { | ||
| context.String(200, "pong\n") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package router | ||
|
|
||
| import ( | ||
| "github.com/gin-gonic/gin" | ||
| "github.com/techbloghub/server/internal/http/handler" | ||
| ) | ||
|
|
||
| func InitRouter(r *gin.Engine) { | ||
| r.GET("/ping", handler.PingPong) | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[질문]
go/gin에서는 기본적으로 깃허브 레포 통해서 패키지를 관리하나요?! 아니면 따로 설정을 해둔건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server/go.mod
Lines 1 to 4 in 77db124
요기 보면 처음에 프로젝트 초기화할때 패키지 모듈명을 이런식으로 원격저장소 주소로 해서 초기화를 보통 합니당.
공식문서에 적혀있는 내용
링크
요거 물어본거가 맞는거겠죠..?ㅎㅎㅎ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 맞습니다 ㅎㅎㅎㅎ