A RESTful API built with FastAPI and MongoDB.
- Python, with
FastAPI
andpymongo
library - MongoDB, as database
- Docker, for deployment
- Clone the repository
- Start the server :
$ docker-compose up -d
- Go to localhost:3000/docs
A RESTful API built with FastAPI and MongoDB.
FastAPI
and pymongo
library$ docker-compose up -d
Rédigez un docker compose permettant de lancer le tout.
Modifiez votre API pour que celle-ci fonctionne avec un stockage des données basé sur un fichier json et non plus une base de données. Pour vous aider, vous pourriez utiliser les appels suivant :
import json
def read_json(json_path):
with open(json_path, "r") as f:
return json.loads(f.read())
def write_json(json_path, data):
with open(json_path, "w") as f:
json.dupmp(data, f, indent=4)
Modifiez votre docker compose pour pouvoir livrer votre nouvelle version
Faites une API Rest avec FASTAPI qui accède à une base de donnée mongodb afin de fournir les endpoits suivants :
Le modèle utilisé, nommé ModelEgg
, doit être composé d'un élevage
(origine de l'oeuf), d'une couleur
(gris, brun, blanc) et d'une immatriculation
(cf. TD Docker). Dans le cas de l'endpoint [POST] eggs
, assurez vous qu'une HTTPException
soit retournée lorsque l'immatriculation fournie est déjà enregistrée.
Indications : vous utiliserez deux conteneurs, le premier remplira une base de donnée (cf. TD Docker), le second exposera l'API Rest sur le port 3000. Il est attendu que votre modèle soit défini dans un fichier model_egg.py
, que votre application RestAPI soit définie dans un fichier app.py
, et que la logique associée au parsing d'immatriculation soit contenue dans un fichier immat_parser.py
.
Note : utilisez des validator
pour vous assurer que l'immatriculation et la couleur du modèle sont valides (https://pydantic-docs.helpmanual.io/usage/validators/).
Retravaillez l'endpoint [GET] eggs/immatriculation
pour qu'il affiche plus d'informations. Celui-ci devra permettre d'afficher (si spécifié) les informations suivantes :
Etendez l'endpoint [POST] eggs
pour que celui-ci n'accepte que des oeufs de poids supérieur à 60g qui ne sont pas pondus un jour pair.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.