Skip to content

andrewn6/api-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api

Stargate - sign up with GitHub login for FREE on DataStax Stargate and get a NoSQL DB up in minutes with approximately 30 million reads, 5 million writes, and 40GB of storage per month for free (Docker container also available)

Open in Gitpod

Description

An API to manage our #EddieHub community data. Documentation https://eddiehubcommunity.github.io/api/

Rules

  • Commits follow the standard Conventional Commit
  • Branches should be named as issue-<issue no> (e.g. NestJs issue number is 12)

Requirements

  • docker
  • node
  • npm

Installation

$ npm install

Running the app locally

For connecting to Datastax Astra or a local stargate docker container the nestjs-astra-package is required. Its hosted in the Github-Package-Repository. For this reason you need to have an environment-variable called GH_TOKEN.

export GH_TOKEN=<Your token>

The Token can be generated in Github and needs the permission package - read. After this step you can run npm install as usual.

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

OR manually with docker docker pull stargateio/stargate-3_11:v1.0.25

Note: if you do not have Docker locally, you can run it against your FREE cloud on AstraDB, by signing up for FREE! You will need to comment out the stargate environment variables in .env and add your Astra credentials

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

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 variables is not true or undefiend 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-seperated.

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

Join our Discord community here Subscribe our YouTube channel here

MADE WITH ❤️ BY EDDIEHUBBERS ✨✨

About

API to manage our community data

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 63.6%
  • Gherkin 34.8%
  • Other 1.6%