- Make a REST API to return info for the open pull requests in a GitHub repository
- For each open PR, the number of commits is returned by making multiple requests via the REST api to fetch the data necessaryCancel changes
- Has one or more API endpoints
- An interface that accepts a repository URL, eg. Zod
- Implement a testing strategy (Postman)
Step 0.
- Generate a PAT from Github with repo access
- Create a .env file in the root of the project following the
env.example
that already exists - Save .env with your token value
Step 1. npm i
to install dependencies
Step 2. npm run build
Step 3. npm run start
Example requests:
GET localhost:8080/pulls?repo=facebook/react
GET localhost:8080/pulls/23144?repo=facebook/react
GET /pulls
- Fetch a list of open pull requests for a given repository with given query params
Available Query Parameters
- repo - To pass the repository URL
- Fully qualified url:
https://github.com/owner/repo
- Schemaless:
github.com/owner/repo
- Just repo:
owner/repo
- Fully qualified url:
I've exported a simple postman collection of requests I used to debug. Simply add your Github PAT to line 136 'value' field of github-api.postman_collection.json