EddieHubCommunity / api

API to manage our community data
https://api.eddiehub.io
MIT License
68 stars 63 forks source link
api hacktoberfest

api

Open in Gitpod

Description

An API to manage our #EddieHub community data.

Rules

Requirements

Installation

Gitpod

Gitpod is a Service, which provides development environments in the cloud. In case no plan is purchased the regular Opensource License allows to use the service for 50 hours per month for free.

All that needs to be done, is logging in to their service with a valid GitHub account.

  1. Install the Browser Extension from Gitpod. [OPTIONAL]
    - Chrome
    - Firefox
  2. Just hit the Gitpod button in the README file. Everything will spin up automatically.
  3. When you're finished with your contribution just close the workspace.

Running the app locally

$ npm install

When using gitpod, you can set environment-variables under the following link https://gitpod.io/variables. You can even scope the variable to a specific project.

For connecting the API against the database you can use docker-compose

# database
$ docker-compose up
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

API-Token

Swagger docs

  1. start the app npm start
  2. visit http://localhost:3000/swagger

Official docs at https://docs.nestjs.com/openapi/introduction

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Logging

Logging can be turned on by settings an environment-variable DEBUG=true. If this variable is not true or undefined no Logs will be made.

When set to true the App will Log every incoming request.

Authentication

Authentication is handled via an environment-variable called APPROVED_TOKENS. The approved tokens which are validated by the API are put there. In case there should be multiple tokens, for multiple clients, they need to be comma-separated.

To use Authentication the token needs to be passed in the token-header of the client-request.

Docker

Build the Docker container

  1. docker build -t eddiehub-api .
  2. docker run -p 3000:3000 -d eddiehub-api
  3. Visit http://localhost:3000/

Running the app via Docker on GitHub Container Registry

  1. docker run -p 3000:3000 -d ghcr.io/eddiehubcommunity/api:latest
  2. Visit http://localhost:3000/

License

MIT licensed.

Socials

Our Pledge

We take participation in our community as a harassment-free experience for everyone and we pledge to act in ways to contribute to an open, welcoming, diverse and inclusive community.

If you have experienced or been made aware of unacceptable behaviour, please remember that you can report this. Read our Code of Conduct.