The project is a test API which assigns tickets to authenticated user in Round Robin fashion.
The API uses a Circular Queue to assign tickets . The queue consists of all the users who have signed up to the API and whose
records are saved in the database. Each time a new user signs-up to the service , its record is created and it is saved in the
database as well as the Circular Queue .
Each time a new ticket is created , it contains information like ticket description
and user who raised
the ticket.
Then the controller calls the Circular Queue instance to return the current head value i.e the user and also move the head to next
user in the queue.You can learn more about Round Robin Principle here
Before setting up the project make sure you have Node.js installed on your system with a package manager of your choice . I recommend NPM or Yarn.
- Fork The repository
- Clone the repository
git clone https://github.com/<Your_User_Name>/TicketAssignAPI.git
- Go into the directory containing the project.
- Install all the dependencies
npm i
ornpm install
- Start the server
npm start
- The server will start at localhost:4000
- Ticket Assignment using Round Robin Principle
- User data stored in cloud database.
- User Sign-up/Sign-in and logout features added.
- A global exception handler is added to look for exceptions.
- Password is stored safely using hashing.
/
: This is the default home route./api/v1/users
: Gives the list of all the users on the service./api/v1/signup
: Signup route that requires username and password in request body./api/v1/singin
: Signin route that requires username and password in request body./api/v1/logout
: Logs out the current user./api/v1/ticket/all
: Returns all the tickets raised . It is a protected route i.e only authenticated users can access this./api/v1/ticket/create
: A protected route that generates ticket . Requires ticket description (desc) as input in request.body/api/v1/ticket/:id
: A protected route that accepts ticket ID as request parameter and returns the ticket with same ID in the response.