From 50d7b8ede5a5cbe64701c1f360c08eb04d9b5796 Mon Sep 17 00:00:00 2001 From: Damien <damien.armillon@gmail.com> Date: Sun, 28 Apr 2019 12:03:42 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=20de=20la=20documentation=20de=20l'A?= =?UTF-8?q?PI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/routes/routesToucan.js | 2 +- doc/API.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 doc/API.md diff --git a/backend/routes/routesToucan.js b/backend/routes/routesToucan.js index 5d36390..7fbe033 100644 --- a/backend/routes/routesToucan.js +++ b/backend/routes/routesToucan.js @@ -38,7 +38,7 @@ router.route("/toucans") if (err) { res.send(err); } else { - res.send({message: "Toucan ajouté !"}); + res.send({message: "Toucan ajouté !", id: id}); } }); }); diff --git a/doc/API.md b/doc/API.md new file mode 100644 index 0000000..400cec0 --- /dev/null +++ b/doc/API.md @@ -0,0 +1,16 @@ +# Documentation API + +L'api permet d'effectuer les actions suivantes sur les routes données : + +1. `api/toucans` : + + * `GET`: Renvoie une liste contenant tous les toucans de la bdd. Les toucans sont sous la forme d'objets avec les champs _id, date et title. + + * `POST` : Permet de sauvegarder un toucan, prend en champs : + + * `date` : Au format Date + * `title` : Une String + * `toucan` : Un pdf + * `cover` : Au format png ou jpg + + Si l'oppération est un succès, on renvoie un message de succès et l'id du toucan enregistré. \ No newline at end of file -- GitLab