Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

BytecodeAgency/PingPong-API

Repository files navigation

Bytecode PingPong Api Project maintainers

Build Status codecov Known Vulnerabilities NodeJS Version AGPLv3 license

Requirements

This application is built to support NodeJS v8 LTS and later.

It is advised to use Yarn as a package manager.

Any database supported by KnexJS can be used.

Installation

After cloning the repository, run yarn to install all dependencies.

Configuration

Before running the application, run the following commands:

cp knexfile.js.example knexfile.js
cp .env.example .env

Now set your configs in the knexfile.js and .env files.

Running the application

For starting the application, run yarn run start, with the NODE_ENV environment variable set matching the environment you want to use in your knexfile.js file.

The NODE_ENVs available by default (package.json) are:

  • development, for yarn run dev
  • production, for yarn run start
  • test, for yarn run test, yarn run test:watch and yarn run coverage

Development

For development and running the integration tests, PostgreSQL should be used.

To use Nodemon (auto restart on save), run yarn run dev.

If you want to run the tests while developing, run yarn run test:watch.

Testing

Tests should be present where possible. Jest is used as testing framework.

For any pull-requests to be accepted, the following commands should pass:

  • yarn run lint
  • yarn run test
  • yarn run build

For checking the code coverage, run yarn run coverage.

Routes

TODO: Add Swaggerhub

All routes are based on /api/v1

GET /status

Returns http code 200

POST /team/create

name: string

POST /team/get-members

Requires auth, add an Authentication header with value Bearer [token].

teamid: number

POST /team/get-all-data

Requires auth, add an Authentication header with value Bearer [token].

teamid: number

POST /player/register

username: string
email: string
teamid: number
password: string

POST /player/auth

Return includes a JWT

username: string
password: string

POST /game/create

Requires auth, add an Authentication header with value Bearer [token].

teamid: number
player1id: number
player1score: number
player2id: number
player2score: number
winner: number
addedby: number

License and maintainers

This project is AGPL-3.0 licensed.

This project is maintained by Bytecode Digital Agency.

Currently, this project is maintained by Bytecode team-members:

For questions regarding this project, please send an email to pingpong@bytecode.nl.

About

Bytecode Ping Pong app API built with NodeJS/Typescript, Express and KnexJS to allow us to track ping pong scores.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published