Initialize the Mongo database with a non-root user (ultimately)
Seed the database with a collection of two genes
Update the API server to list genes from the database
Map Gene document object to DTO
Add the host names model-ad-api and model-ad-mongo to the dev container
Start the Mongo container when starting the API server
Note
The conversion of Documents to DTOs and vice versa is done using the monorepo shared library shared-java-util. This demonstrates the re-usability of Java code across projects in the monorepo.
Start the API server and MongoDB with Docker Compose
nx serve-detach model-ad-api
Visualize the collection gene with the MongoDB extension for VS Code
Profile:
Host: model-ad-mongo
Port: 27017
Authentication
Username: modelad (defined in apps/model-ad/mongo/.env)
Password: changeme (defined in apps/model-ad/mongo/.env)
List genes
Using Swagger UI, a browser or the file apps/model-ad/api/requests.http:
GET http://localhost:8080/v1/genes
HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 20 Jun 2024 16:57:40 GMT
Connection: close
{
"number": 0,
"size": 2,
"totalElements": 0,
"totalPages": 1,
"hasNext": false,
"hasPrevious": false,
"genes": [
{
"id": "66737b304e11611be5dab31c",
"name": "BRCA1",
"description": "BRCA1 Gene: A Key Player in Breast Cancer Susceptibility"
},
{
"id": "66737b304e11611be5dab31d",
"name": "TP53",
"description": "TP53 Gene: Guardian of the Genome and Its Role in Cancer Prevention"
}
]
}
Changelog
model-ad-api
andmodel-ad-mongo
to the dev containerNote
The conversion of Documents to DTOs and vice versa is done using the monorepo shared library
shared-java-util
. This demonstrates the re-usability of Java code across projects in the monorepo.Preview
Build MODEL-AD images
or just the images needed to test this PR:
Start the API server and MongoDB with Docker Compose
Visualize the collection
gene
with the MongoDB extension for VS CodeProfile:
apps/model-ad/mongo/.env
)apps/model-ad/mongo/.env
)List genes
Using Swagger UI, a browser or the file
apps/model-ad/api/requests.http
: