Skip to content

paxti/time-to-coup-api

Repository files navigation

header image

tested with jest Codacy Badge Codacy Badge

Time to Coup

GraphQL based API to track history of Coup G54 games.

ESLint rules

Notable rules

  • "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]

Prettier rules

{
  "printWidth": 80,
  "singleQuote": true,
  "arrowParens": "always"
}

GraphQL

Avaliable schemas

type Card {
  name: String!
  action: String!
  category: String!
  counteraction: String
}

type Session {
  id: String!
  name: String!
  rounds: [Round]
}

type Round {
  id: String!
  winner: String
  players: [String]!
  type: String!
  session: Session
}

type Mutation {
  addSession(name: String): Session
}

type Query {
  randomDeck: [Card]!
  cardsInCategory(category: String!): [Card]
  card(id: Int!): Card
  cards: [Card]
  session(id: String!): Session
  sessions: [Session]
  rounds: [Round]
  round(id: String): Round
}

Also subscription is avaliable for Sessions

subscription sessionAdded {
  sessionAdded {
    name
  }
}

Install & Run

Prerequisites

You need active MongoDB server available to run or test the application locally.

Add .env file

MONGO_DB_CONNECTION=mongodb://localhost:27017/myproject
MONGO_DB_TEST_CONNECTION=mongodb://localhost:27017/myproject_test
PORT=8080

Run npm install to install all packages, and npm run dev to start app with hot reload using nodemon.

Run npm run build && npm run start to use production version. Run npm run test for testing.

CI pipeline

GCP Cloud Build used to build test and deploy an app to the GCP App Engine. Take a look at cloudbuild.yaml and app.yaml for more information. To be able to deploy app successfully to Cloud Build you would need to encrypt .env file with prod values using kms and commit it to the repository. Also, you need to update keyName and keyRing in cloudbuid.yaml more information here

Demo

Demo avaliable at https://time-to-coup.appspot.com

📄 License

MIT License

About

Use in case when it's time to coup ;)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published