ricardoferreirasilva / github-consumer-example

A simple API that consumes the Github API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

Description

A simple NestJS application that uses the Github API to list user repositories.

Environment Variables

While it is possible to use the endpoint without setting up the Github access token, it is advisable to use a github OAuth token if you find yourself being rate-limited by the Github API, which only allows a certain ammount of non-authenticated requests per IP.

  1. TOKEN = (github OAuth token)

You can load environment variables by creating a .env file at the root of the project.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

The request endpoint can be found in http://localhost:3000/github/repositories . It is a GET request and it expects to receive a username param and the Accept header properly set up to application/json. You can find a curl example bellow.

curl -X GET \
  'http://localhost:3000/github/repositories?username=ricardoferreirasilva' \
  -H 'accept: application/json' \
  -H 'cache-control: no-cache' \
  -H 'postman-token: 3b64c5d0-f52d-41b6-ba12-213c356bc294' \

Test

# unit tests
$ npm run test

# test coverage
$ npm run test:cov

# test end to end
$ npm run test:e2e

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

About

A simple API that consumes the Github API.

License:MIT License


Languages

Language:TypeScript 100.0%