From 2c95d5b10a1918071adfd6a62c4bb88f3133a240 Mon Sep 17 00:00:00 2001 From: Carmine DiMascio Date: Sat, 27 Jan 2024 14:34:51 -0500 Subject: [PATCH] add cookies to examples 1 and 2 (#891) * remove examples from schema * add cookies to example 1 and 2 --- examples/1-standard/app.js | 2 ++ examples/2-standard-multiple-api-specs/app.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/examples/1-standard/app.js b/examples/1-standard/app.js index 1de69e01..8b55477f 100644 --- a/examples/1-standard/app.js +++ b/examples/1-standard/app.js @@ -1,6 +1,7 @@ const express = require('express'); const path = require('path'); const http = require('http'); +const cookieParser = require('cookie-parser'); // Add if using cookie auth const { Pets } = require('./services'); const OpenApiValidator = require('express-openapi-validator'); @@ -12,6 +13,7 @@ const apiSpec = path.join(__dirname, 'api.yaml'); app.use(express.urlencoded({ extended: false })); app.use(express.text()); app.use(express.json()); +app.use(cookieParser()); // Add if using cookie auth enables req.cookies // Optionally serve the API spec app.use('/spec', express.static(apiSpec)); diff --git a/examples/2-standard-multiple-api-specs/app.js b/examples/2-standard-multiple-api-specs/app.js index 8f002ea8..2fb9bf07 100644 --- a/examples/2-standard-multiple-api-specs/app.js +++ b/examples/2-standard-multiple-api-specs/app.js @@ -1,12 +1,15 @@ const express = require('express'); +const cookieParser = require('cookie-parser'); const path = require('path'); const http = require('http'); + const OpenApiValidator = require('express-openapi-validator'); app = express(); app.use(express.urlencoded({ extended: false })); app.use(express.text()); app.use(express.json()); +app.use(cookieParser()); // add if using cookie auth const versions = [1, 2];