Skip to content

An API for collecting and presenting data about Github Repositories.

Notifications You must be signed in to change notification settings

dev-John/lib-quality

Repository files navigation

lib-quality

Table of Contents

About

An API for collecting and presenting data about Github Repositories

Project structure

├───.github/
│   └───workflows/
│       └───workflow.yml -> Github Actions Workflow
├───src/
│   ├───api/
│   │   └───repository/
│   │       ├───index.ts -> Inits the routes
│   │       ├───repositoryController.ts -> Repository controllers
│   │       ├───repositoryValidator.ts -> Repository schema validators
│   │       └───routes.ts -> Routes related to repository
│   ├───config/
│   ├───constants/
│   ├───db/
│   ├───interfaces/
│   ├───models/
│   ├───services/
│   ├───tests/ -> Automated unit tests
│   │   ├───services/
│   │   ├───utils/
│   │   └───_in-memory-db.ts -> In Memory Mongodb for tests
│   ├───utils/
│   ├───index.ts -> Starts the server, routering, pluggins, etc
│   └───server.ts -> Server configurations

[IMPORTANT] Github Personal Access Token

Running Locally

To access the Github API you need a personal Access Token to be sent in the headers. See how to generate one HERE

Example of sending the token on the request:

on Postman:

on Swagger:

Running Locally

You will need NodeJS (V. 14 or +), npm, Docker and docker-compose

Clone this repo and run the following commands:

npm install
docker-compose up

Then you can access the API in http://localhost:3000 or http://0.0.0.0:3000

See the Docs on Swagger for informations about the routes, params and headers

Swagger Documentation

After running the project open the browser in http://localhost:3000/documentation

Unit tests

For the unit tests, the project uses an In Memory Mongodb Server. To execute the unit tests run:

npm test

Tecnologies used

NodeJs - Server Environment

Hapi - Server Framework

Mongodb - Cloud NoSQL Database

Mongodb in memory - In memory database for testing purpose

Docker - Image deployment

AVA - Test Framework

Joi - Schema description language and data validator