This is a minimalist quiz application built with Fastify, featuring PDF generation and QR codes for answers.
- Display a list of quiz questions
- Show individual questions with multiple-choice answers
- Generate QR codes for answer URLs
- Create PDF documents for each question
- Node.js
- npm
-
Clone the repository:
git clone git@github.com:cbouvard/quiz.git cd quiz -
Install dependencies:
npm install -
Update the
questions.jsonfiles with your quiz question. -
Update the
views/*.ejsandpublic/logo.pngwith your context.
-
Start the server:
node app.js -
The server will start on port 3000 by default. You can change this by setting the
PORTenvironment variable. -
Access the application in your web browser at
http://localhost:3000.
/questions: List all questions/questions/:questionId: Display a specific question/questions/:questionId/answer: Show the answer to a specific question/questions/:questionId/answer/qrcode: Generate a QR code for the answer URL/questions/:questionId/pdf-document: Generate a PDF document for a specific question
app.js: Main application fileviews/: Directory containing EJS templatespublic/: Directory for static files (includinglogo.png)questions.json: JSON file containing quiz questions (you need to update this)
fastify: Web framework@fastify/static: Plugin for serving static files@fastify/view: Plugin for template renderingejs: Templating enginepdfkit: PDF generation libraryqrcode: QR code generation library
PORT: Port number for the server (default: 3000)
MIT
