This project is a backend service built using TypeScript, Node.js, and Express.js for a quiz application. It allows users to create, fetch, and submit answers to quizzes and receive feedback.
- Create Quiz: API to create a new quiz with a set of multiple-choice questions.
- Fetch Quiz: API to retrieve quiz details without revealing the correct answers.
- Submit Answers: API to submit an answer and receive feedback on correctness.
- Get Results: API to fetch the user's results for a specific quiz.
- Testing: Unit and integration tests are implemented using Jest.
- Node.js - Backend runtime environment.
- Express.js - Web framework for building RESTful APIs.
- TypeScript - Superset of JavaScript used for static type checking.
- Jest - Testing framework for unit and integration tests.
Ensure you have the following installed on your local machine:
- Node.js (v14 or higher)
- npm or yarn (package manager)
-
Clone the repository:
git clone https://github.com/sagar-gavhane/quiz-api.git cd quiz-api -
Install the dependencies:
yarn install
-
Run the development server:
yarn run dev
The server will start on
http://localhost:3000. -
Run the production server:
npm run start
To run the test suite using Jest:
yarn run testyarn run test:watchThis will run all unit and integration tests to ensure the application is functioning as expected.
To check the code coverage of the tests:
yarn run test:coverageThis will generate a coverage report showing the percentage of code covered by tests.