Discover Packages
github.com/harrison-minibucks/github-api-demo
module
Version:
v0.0.0-...-ce2ccc6
Opens a new window with list of versions in this module.
Published: Jun 6, 2023
License: MIT
Opens a new window with license information.
README
README
¶
GitHub API Demo
This is a simple API demo that can authorize user with either a GitHub Token, or through harrison-minibucks GH App.
Setup
Install golang
Install Protobuf
Optionally, install Make cli, or sudo apt install make
Run make init
to install the dependency tools (Or run the command lines listed in the Makefile)
Generate a new GitHub Personal Access Token (PAT )
Optionally
If you want to use GitHub App, please setup one and add the client_id
and client_secret
to ./configs/secret.yaml
, sample is shown on ./secret-sample.yaml
.
Setup the GitHub APP callback url to http://localhost:8000/github/callback
Otherwise, you may use GitHub PAT for the Authorization
header to test the API
Development
Set go env -w GO111MODULE=on
(to accomodaate Kratos)
Run go mod tidy
Run make db
Run make run
Docker Setup
Install Docker
Run docker compose up
Unit Test
Run make test
to run unit tests
HTTP API Testing
Please refer to the file ./rests/todo-api.http
and ./rests/gh-api.http
(Install REST Client in VSCode for easier testing).
Or, you can head to Swagger and paste the contents in openapi.yaml
You can head to http://localhost:8000/github/login to login into your GitHub App, and a Session
will be returned
You could either use Authorization
with GitHub PAT, or use Session
with the session ID returned as your header
/github/avatar and /github/logout is not implemented yet
GRPC server is not started.
Others
You may refer to the Makefile.
Expand ▾
Collapse ▴
Directories
¶
Click to show internal directories.
Click to hide internal directories.