A project using Web API (Asp.Net Core 2.2), xUnit, RabbitMQ, NoSQL Database (MongoDB) and also Docker.
- Once you insert some research, this research will be published into the queue and then all the family tree will be published as well;
- There will be some hosted services that will consume the messages and then it will be written into the database;
- After these steps, you can access the MongoBD Express and check all the available documents.
- Asp.Net Core 2.2 (SDK or Runtime);
- Docker Desktop - to run Linux Containers;
-
Clone the git repository;
-
Open the local folder where the repository was downloaded;
-
Go to the folder where you can find the
docker-compose.yml
file; -
In this folder, open the command prompt (e.g.: cmd.exe);
-
Execute the following commands:
- Build Images
docker-compose build
- Compose Containers
docker-compose up -d
-
Once you run the above command, all the images I've set up in the
docker-compose.yml
file will start their own containers. -
In order to check the running containers you can run the following command:
docker container ps
-
If you want to check what port the API is using, you can run the following command:
docker-compose ps
-
If the API doesn't open automatically on the browser, you can use the above command to get the port is being used for the API and access the API with this URL:
http://localhost:<port>/swagger/index.html
: where<port>
will be the port listed by the commanddocker-compose ps
.- Important! - You have to use the
HTTP
port that points to port80
.
-
The API will open a new tab using your default web browser and the swagger page will be available to test all the endpoints.
- You'll need to register some data before using the GET endpoints, so...
- Firstly, you should register a research using the endpoing
/api/researches/insert-one
- Now you can go and test the other endpoints!
-
RabbitMQ:
- URL:
http://localhost:15672/
- User: user
- Password: pass
- Virtual-Host: challenge-dev
- URL:
-
Mongo
- Port: 27017
-
MongoDB Express
- URL:
http://localhost:8081/
- User: user
- Password user123
- URL:
I hope you enjoy the code.