QuizWiz is a RESTful API application designed for managing and answering multiple-choice quizzes. It allows users to create quizzes, retrieve them, submit answers, and view results.
These instructions will help you set up and run the QuizWiz application locally.
Make sure you have the following installed:
-
Clone the repository:
-
Install dependencies and Compile TypeScript to JavaScript:
yarn setup
-
Start in development mode:
yarn start
This will use
ts-nodeto run the application directly with TypeScript.
-
Setup:
yarn setup
This installs dependencies and compiles TypeScript files.
-
Clean:
yarn clean
This removes the
distdirectory,node_modules, and clears the Yarn cache. It also runsyarn setupto reinstall dependencies and recompile.
-
Create a Quiz:
POST /quiz- Request Body:
CreateQuizDTO - Description: Creates a new quiz with a title and a list of questions.
-
Retrieve a Quiz:
GET /quiz/:id- URL Parameters:
id(Quiz ID) - Description: Fetches a quiz by its ID.
-
Submit an Answer:
POST /quiz/answer/:userId- URL Parameters:
userId(User ID) - Request Body:
SubmitAnswerDTO - Description: Submits an answer for a quiz question.
-
Retrieve Results:
GET /quiz/:quizId/results/:userId- URL Parameters:
quizId(Quiz ID),userId(User ID) - Description: Fetches quiz results for a specific user.
express: Web framework for Node.js.class-validator&class-transformer: For data validation and transformation.uuid: For generating unique IDs.
typescript&ttypescript: For TypeScript support.ts-node: TypeScript execution environment.tsconfig-paths: For resolving module paths.@types/*: TypeScript type definitions.
Taher Ali
- In-Memory Storage: QuizWiz currently stores data in memory. This means that any data (quizzes, results, etc.) will be lost when the server is restarted or shut down. For persistent storage, consider integrating a database.
- This project uses several open-source libraries and tools that have been instrumental in its development.