This is a website created with golang, using gin-gorm for routing purposes and mongoDB for storing github tokens. Also, JWT tokens are used for authentication purposes. A good UI interface could not be implemented, so you need to hit the routes manually on a browser. It is suggested to use Mozilla Firefox or postman for prettier JSON response.
These instructions will guide you on how to set up and run the project on your local machine.
- Go installed on your machine
-
Clone the repository
git clone https://github.com/bmerchant22/pclub-task-2.git
-
Change to the project directory
cd pclub-task-2
-
Install dependencies
go get ./...
-
Run the main file
go run cmd/web/main.go
Routes that can be accessed by a user even if he is not authenticated and logged in
- "/": This is the home route
- "/users/:username": On this route, you can view general details about any github user i.e. username, followers, following, public repos etc. You can also view the most popular repo of the user.
- "/repos/:username/:repo": On this route, you can view any public repo of any user, containing name, desc, createdAt, language and such details.
Routes where you need to authorize yourself and github
- "/login": When you hit the login route, you will be redirected to login on github, you need to enter your username and password. Then, after you sign in, you will be taken to a page where github asks you for authorizing my oAuth app.
- "/callback": Once you authorize my oAuth app, you will be redirected to callback route, and this will store your access tokens in the mongodb.
These are the route which you can access only if you are verified by github and you have authorized my oAuth app on github. Once you are authorized, the callback will redirect you to the /user route itself
- "/user": On this route, details of the logged in user is shown. This includes the normal user details plus the recent activity and most used language of the user.
- "/repos": On this route, all public and private repos are listed with their names and links to their individual details.
- "/private-repos": On this route, all private repos of the user are listed
- "/user-repos/:repo": On this route, individual repos of the logged-in user can be seen. In addition, list of collaborators and contributors with their individual detail routes can also be seen. Also, the commits can be viewed.
If any error occurs while cloning and running the code, you can contact me at:
Discord: victorX#7731
Mail: bmerchant22@iitk.ac.in