How gitmicafri/quiztopiauppgift works
Project Type and Purpose
• Type: A serverless API backend.
• Purpose: To power a quiz application where users can register, log in, create quizzes, add questions (including geolocation data) and delete quizzes, with additional features (such as a leaderboard) specified in the guidelines.
• Technologies: AWS Lambda, API Gateway, DynamoDB, Serverless Framework, Middy middleware for error handling and validations, JSON Web Tokens (JWT) for authentication, and JSON schemas for request validation.
Analyzing the File Structure
• Key directories:
– /src/handlers: Contains Lambda handlers for endpoints (signIn, signUp, createQuiz, getQuiz, getAllQuizzes, deleteQuiz, postQuestion).
– /src/middleware: Implements middleware (e.g., token validation) likely integrated with Middy.
– /src/schemas: Holds JSON schema files (for validating signIn, signUp, quiz creation, and question posting).
– /src/services and /src/utilities: Contain helper services and utilities (e.g., token generation) used by various handlers.
• Configuration files:
– serverless.yml: Configures deployment for AWS Lambda, API Gateway endpoints, DynamoDB integration, and other AWS resources.
– package.json: Lists dependencies that include serverless, Middy, and JSON Web Token libraries.
• Additional: documentation.json might be serving internal documentation or further details of the API design.
Examining the README
• The README provides functional and technical requirements that emphasize modular endpoints (account creation, quiz management, question management, leaderboard functionality) along with integration points with AWS services.
• It highlights the importance of error handling (especially with DynamoDB) and authentication for user-specific operations.
• The technical stack is explicitly mentioned: Serverless, AWS Lambda, API Gateway, DynamoDB, Middy, and JSON Web Token.
• Use clear, concise labels for each component (e.g., “API Gateway”, “SignIn Lambda Handler”, “ValidateToken Middleware”).
• Including a section for error handling flows, indicating where error messages are caught and returned if something goes wrong with DynamoDB or if JWT validation fails.
Final Touches
– Add annotations to describe critical interactions or any non-trivial design decisions (such as how schema validations are enforced or how the JWT middleware fits into the processing chain).
– Since the project relies on the Serverless Framework, you might also include a note on how deployment configurations (from serverless.yml) tie into the overall architecture.