""" Objective: Build a simple REST API to manage user sessions in-memory. It can be written in Python or Javascript.
Requirements (by priority):
- Expose endpoints to:
- Login (create session)
- List active sessions
- Logout (invalidate session)
- Define User and Session models with fields like id, username, token, and expires_at.
- Store sessions in-memory (dictionary or simple repository class).
- Include unit tests for session creation and invalidation.
- (Nice to have, if time allows) Add a simple background cleanup task that removes expired sessions.
- (Optional, but very important to keep in mind) Apply one design pattern such as Singleton for the SessionManager.
Instructions:
- Communication is the most important part of it: please try to keep communicating your thought process, the decisions you're making and why are you making it, ask questions to avoid assumptions;
- Google search and official documentations are allowed to use, AI is not;
- The project needs to be build on an IDE so I can see how you debug and outputs. At the end, paste your progress back into this code editor for evaluation. """