Skip to content

riccycastro/Github-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cocus backend developer task

The purpose of this project is to allow the end client to get a Github account repositories and all current active branches from a unique endpoint call.

The problem

As an api consumer, given username and header “Accept: application/json”, the consumer would like to list all his github repositories, which are not forks. The required information in the response, are:

  1. Repository Name
  2. Owner Login
  3. For each branch it’s name and last commit sha

As an api consumer, given header “Accept: application/xml”, I would like to receive 406 response in such a format:

{
    “status”: ${responseCode}   
    “Message”: ${whyHasItHappened}
}

Docker setup

First, make sure that you have Docker and Docker-compose installed in your machine. Clone this repo, enter the project folder and run

    docker-compose up -d --build

This should be enough to have the app server up and running.

Be aware that at the first time you start the server, it will install the project dependencies. It takes some seconds to complete

After that you need to config the hostname. To do that just copy the contenct from the host file(./webserver/host) and append it to /etc/hosts

Now you can access the application here: http://api.cocus-backend.local/

To make it easier, the application container have the port 3333 exposed to your local machine so you can access the application here: http://localhost:3333


Dockerless

First, you need to set some configurations manually. Clone the .env.example and remove the example from the cloned one. Specify the PORT and HEADER_ACCEPT though they are not mandatory, the only required one is the GIT_REPOSITORY_API_URL

Note: Env vars will override the .env file configurations

Go to the application folder cocus-backend-developer-task/application and install the dependencies

npm install

And start the application

npm run start:dev

To run all tests

    npm run test

E2E tests

    npm run test:e2e

Unit tests

    npm run test:unit

Lastly

Normally I would split the docker project from the application but for the sake of simplicity they are in the same project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published