From 3086661c128d2e2a1ffbe8dfb9817bcfaba60abe Mon Sep 17 00:00:00 2001 From: "art.dambrine" Date: Wed, 25 Mar 2020 16:58:41 +0000 Subject: [PATCH] [FIX] 20200325 17:40 --- app.js | 2 +- docs/swagger.json | 22 ++++++++++++++++++++++ routes.js | 10 +++++----- welcome_page/index.html | 6 +++--- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/app.js b/app.js index 2d028b8..427147e 100755 --- a/app.js +++ b/app.js @@ -25,7 +25,7 @@ app.use(bodyParser.json()); // Route pour notre documentation app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); // documentation à la racine -app.get('/', (req, res) => res.sendFile(path.join(__dirname + '/welcome_page/index.html'))); // route racine +app.get('/', (req, res) => res.sendFile(path.join(__dirname + '/welcome_page/index.html'))); // route welcome page app.use("/api",routes) // route /api par défaut diff --git a/docs/swagger.json b/docs/swagger.json index 5d789ac..231a9b3 100755 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -21,6 +21,28 @@ ], "paths": { "/etudiants": { + "get": { + "tags": [ + "etudiant" + ], + "summary": "Retourne la collection d'etudiants", + "description": "Retourne l'ensemble des etudiants", + "operationId": "getetudiants", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/etudiant" + } + }, + "404": { + "description": "etudiants not found" + } + } + }, "post": { "tags": [ "etudiant" diff --git a/routes.js b/routes.js index f34d902..85a5760 100755 --- a/routes.js +++ b/routes.js @@ -5,7 +5,7 @@ const router = express.Router() router.get('/', function (req, res) { res.json({ status: "L'API fonctionne", - message: "Bienvenu sur l'API Etudiants" + message: "Bienvenue sur l'API Etudiants, retrouvez la doc à http://localhost:3000/docs/" }); }); @@ -18,10 +18,10 @@ router.route('/etudiants') .post(etudiantController.new); router.route('/etudiants/:etudiant_id') -.get(etudiantController.view) -.patch(etudiantController.update) -.put(etudiantController.update) -.delete(etudiantController.delete); + .get(etudiantController.view) + .patch(etudiantController.update) + .put(etudiantController.update) + .delete(etudiantController.delete); module.exports = router //module.exports en fin de fichier pour export API routes \ No newline at end of file diff --git a/welcome_page/index.html b/welcome_page/index.html index a106f82..b92a14d 100755 --- a/welcome_page/index.html +++ b/welcome_page/index.html @@ -92,7 +92,7 @@ header nav{ } header nav ul li{ - float: left; + /* float: left; */ display: inline-block; } @@ -309,12 +309,12 @@ footer h1{ Let's go ! -