Author : Kerfalla CISSE
Mandate carried out jointly with the University of Geneva
Framework used : Fast API
Documentation of the API : http://127.0.0.1:8000/docs
To Install the dependencies :
- Create a virtual environment :
python -m venv .venv
- Activate the virtual environment :
source .venv/Scripts/activate
- Install the dependencies :
pip install -r requirements.txt
To launch the project (be sur that you are in the virtual environment) : fastapi dev main.py
Launch the docker-compose.yaml file which will run the mongodb database : docker compose up -d
Execute the bash script (to create the database, the collection and the user):
chmod +x init_mongo.sh
make the file executable- Execute the file :
./init_mongo.sh
To connect to the mongodb service with docker : docker exec -it <service_name> mongosh -u <username> -p "<password>" --authenticationDatabase <database_name>
To create a database : use <database_name>
To create a collection use <collection_name>
To insert data in a collection : db.projects.insertOne({ project_name: "Test Project", user_id: ObjectId("0123456789ab0123456789ab") })
To create a user :
db.createUser({ user: "myuser", pwd: "mypassword", roles: [{ role: "readWrite", db: "linked_data_governance" }] })