/quiz-builder-app

An app that allow authenticated users to create their own quizzes and anonymous visitors to take them and see how many questions they got right.

Primary LanguageTypeScript

QUIZ BUILDER APP

A simple quiz builder

Server

Setup

To setup the server, enter the client directory.

$ cd server

Create a .env file and copy the code below into the file.

PORT=5000
TOKEN_SECRET=<generated-token-secret>

MONGODB_CONNECTION_URL=<mongodb-connection-url>
MONGODB_CONNECTION_URL_TEST=<mongodb-connection-test-url>

Create a MongoDB Cluster and add replace <mongodb-connection-url> & <mongodb-connection-test-url> with the actual connection url. Make sure the database name is included in the url.

To generate the TOKEN_SECRET, run the following commands below

$ node -i

then

> require('crypto').randomBytes(32).toString('hex')

Replace with the hexa-decimal output from the command above.

Test

$ npm test
$ npm run test:file <path-to-test-file>

Run

$ npm start
$ npm run start:dev

API Documentation

https://documenter.getpostman.com/view/6884204/UzR1LNRU

Client

Setup

To setup the client, enter the client directory.

$ cd client

Create a .env file and copy the code below into the file.

REACT_APP_APPID=<generated-token-secret>
REACT_APP_DOMAIN=http://localhost:3000
REACT_APP_API_DOMAIN=http://localhost:5000

To generate the REACT_APP_APPID, run the following commands below

$ node -i

then

> require('crypto').randomBytes(32).toString('hex')

Run

$ npm start

Open http://localhost:3000 to view it in the browser.

Build

$ npm run build