The Search-Service provides a single API endpoint to search for GitHub users by specifying a programming language they use in their public repositories and a username string.
The Search-Service combines different npm modules for it to work normally:
- Nodejs
- Express
- Got
- Jest
Search-Service is a backend service with a single API endpoint that return git users with the below properties:-
- Username
- Name
- Avatar URL
- Number of followers
- Install git, node, npm.
- Download Code Editor of your choice (VSCode recommended).
- Clone the repo ( link or use
git clone [email protected]:Babanila/search-service.git
). - Go into root of the cloned directory and run
npm install
. - Open the editor (VSCode) and locate the downloaded directory to start developing (or with
code .
in the project director on your terminal).
- To start the server, from the root directory run
npm run start
ornode server.js
. - Open web browser and goto
http://localhost:8080/get-users
-
Goto
http://localhost:8080/get-users
-
Add query parameters, username and language (must be supplied).
E.g - http://localhost:8080/get-users?username=adam&language=javascript
- http://localhost:8080/get-users?username=john&language=java,go
-
Press enter button.
- From the root directory run
npm run test
.
-
Install docker on your system(Docker link).
-
Create docker account (Create docker account).
-
Login to docker.
-
Then the below docker commands can be carried out.
-
docker build -t <docker_username>/node-search-app .
E.g
docker build -t babanila/node-search-app .
-
docker push <docker_username>/node-search-app
E.g
docker push babanila/node-search-app:latest
To pull the docker image from dockerhub
-
docker pull <docker_username>/node-search-app
E.g
docker pull babanila/node-search-app
-
docker run --publish 3000:8080 --detach --name
E.g
docker run --publish 3000:8080 --detach --name test1 <docker_username>/node-search-app:latest
-
Add the query parameters
(username and language)
to the urllocalhost:3000/get-users
E.g
curl -i http://localhost:3000/get-users?username=babanila&language=javascript
In other for this solution to be well tested considering the rate limitation imposed by Github API for usage without Basic Authentication or OAuth (up to 5000 requests per hour
), the search result output can be limited to a certain number like 10, 20 etc.
In the Controller.js file on line 62, can be changed to searchResults.slice(0,10)
, for the first 10 search results.