Code Monkey home page Code Monkey logo

search-service's Introduction

Search-Service

Overview of Search-Service

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.

Modules

The Search-Service combines different npm modules for it to work normally:

  • Nodejs
  • Express
  • Got
  • Jest

Table of Contents

Features

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

Requirements

  • 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).

How To Start The Server From The Root Directory

  • To start the server, from the root directory run npm run start or node server.js.
  • Open web browser and gotohttp://localhost:8080/get-users

Usage

  • 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.

Test

  • From the root directory run npm run test.

For Docker Usage

Login to Docker

  • 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.

To create docker image

  • docker build -t <docker_username>/node-search-app .

    E.g docker build -t babanila/node-search-app .

To push the docker image to personal account

  • 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

To run docker image in container

  • docker run --publish 3000:8080 --detach --name

    E.g docker run --publish 3000:8080 --detach --name test1 <docker_username>/node-search-app:latest

Test the connection

  • Add the query parameters (username and language) to the url localhost:3000/get-users

    E.g curl -i http://localhost:3000/get-users?username=babanila&language=javascript

Note

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.

search-service's People

Contributors

babanila avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.