This is an example of a microservice for PV217 Service Oriented Architecture
The python package:
Clone the repository:
git clone https://github.com/i32ropie/n-queen-microservice
Compile the tool that solves the N-Queen problem
make
Run the server
./run.sh
After running the server, you can go to your $HOST:8000 ($HOST is where you execute the microservice) to see the documentation that Hug creates. Following it, you can see that for getting the solutions for the N-Queen problem, you just go to $HOST:8000/get_n_queen_solutions and use the parameter n to specify the N. For example given $HOST:8000/get_n_queen_solutions?n=6, the microservice will show us the 4 solutions.
- This will run Hug server, which shouldn't be used for production, just for testing. You could use uwsgi as explained here.
- The tool used for solving the N-Queen problem is an adapted version of this.
For testing reasons I coded a Telegram bot to show that the microservice works and can be used.
The code is provided and a video with an example too.