Lets create a Queue System: Queue system are heavily used in Goverment institutions, airports, banks and many other venues looking to organize the incoming traffic. Queue systems can also be used to load balancing for different applications like:
Do not clone this repository.
The first step to start coding is cloning the python boilerplate on your local computer or opening it using gitpod.
a) If using Gitpod (recommended) you can clone the boilerplate by clicking here.
b) If working locally type the following command from your command line:
1https://github.com/4GeeksAcademy/flask-rest-hello`
๐ก Important: Remember to create a new repository, update the remote (git remote set-url origin <your new url>
), and upload the code to your new repository using add
, commit
and push
.
1class Queue: 2 3 def __init__(self): 4 self._queue = [] 5 # depending on the _mode, the queue has to behave like a FIFO or LIFO 6 self._mode = 'FIFO' 7 8 def enqueue(self, item): 9 def dequeue(self): 10 def get_queue(self): 11 def size(self): 12 return len(self._queue)
POST /new
) with any particular priority (FIFO or LIFO).GET /next
gets executed to process the person on the queue.GET /next
request is received, the next person on the queue gets processed until it is Bob's turn./new
: Will recive information about a user and ad him into the queue./next
: Will process one spot of the queue./all
: Will return a list with everyone that is pending to be processed (the current queue) .This exercise will make you practice the following fundamentals: