A RESTful API service for creating trivia quizzes.
Each question in a quiz must have four possible answers, but only one will be the correct one.
What are you waiting for? Run the application and put all your knowledge there!
$ docker compose -f docker-compose.yml -f docker-compose.prod.yml -p trivia-quiz up
Add -d
to start all containers in detached mode (you won't see any logs).
If you want to change the environment variables, edit ./env/.env.production
(see descriptions below).
Visit http://localhost:3000/swagger for APIs documentation (host and port according to environment variables).
When the application starts for the first time, John Doe is already there waiting for you with the following credentials:
email: "[email protected]"
password: "YnTR8!rQ"
Once the server is running, play with the APIs using Postman. All you have to do is:
- create a workspace (e.g. Trivia Quiz API)
- import data from the
./postman
folder
Hope you have fun!
In order to run the code in watch mode:
$ npm install
$ cp env/.env.development .env
$ docker compose up
$ npm run start:dev
$ npm install
$ docker compose -p trivia-quiz up -d
$ npm run test
Use npm run test:cov
for coverage.
NODE_ENV
Required: true
Description: node environment.
Values: [development
, production
, test
]
HOST
Required: false
Description: domain name of the network host or its IP address.
PORT
Required: true
Description: port number to connect to.
LOGGER_LEVEL
Required: true
Description: console logger level.
Values: [silent
, error
, warn
, info
, http
, verbose
, debug
]
LOGGER_PRETTY
Required: false
Description: boolean to enable/disable logs formatting.
LOGGER_REDACT
Required: false
Description: string of keys separated by comma that hold sensitive data to hide in the log output.
MONGODB_URI
Required: true
Description: MongoDB connection URI.
MONGODB_MIGRATIONS_FOLDER
Required: true
Description: MongoDB migrations folder.
Values: [development
, production
, test
]
JWT_ISSUER
Required: true
Description: principal that issued the JWT.
JWT_PUBLIC_KEY
Required: true
Description: PEM encoded public key for RSA and ECDSA.
JWT_PRIVATE_KEY
Required: true
Description: PEM encoded private key for RSA and ECDSA.
JWT_EXPIRES_IN
Required: true
Description: expiration time of the JWT expressed in a string describing a time span vercel/ms.