Get Repository Branches
About
- The getRepositoryBranchListfunction, an Express.js route handler, fetches and communicates a GitHub repository's branch list for a specified user. It verifies the user's existence, throwing aUserNotFoundErrorif not found, and fetches the repository document. Utilizing thegetRepositoryBranchesfunction, it retrieves the branch list, handling aFailedToGetRepoistoryBranchserror if unsuccessful. The function then updates the repository document with branch details and responds with a JSON object containing the branch information. Robust error handling caters to user absence or branch retrieval failure, providing specific error responses for each case, ensuring a smooth user experience.
Flow
Endpoint
Route/Repoistory/repos.routes.js
ReposRouter.get("/user/repos/repo/getBranches", getRepositoryBranchList);