From f4be2b24720f2e5750ac592b9ef120ca6ed04dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Galvagno=20S=C3=A9bastien?= Date: Mon, 23 Sep 2024 15:45:38 +0200 Subject: [PATCH] cleanup --- app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app.js b/app.js index 4a96814..44217a3 100644 --- a/app.js +++ b/app.js @@ -17,6 +17,7 @@ const app = express(); // const apiSpec = path.join(__dirname, 'api.yaml'); const apiSpec = path.join(__dirname, 'zooprocess.openapi.yaml'); + function verifyToken (req, res, next){ console.log("verifyToken middleware") @@ -38,6 +39,7 @@ function verifyToken (req, res, next){ } } + function extractJWT(req, res, next){ if ( req.token ){ @@ -206,6 +208,7 @@ async function getRole(req, res, next){ // return handler[method]; // } +// console.log("modulePathResolverSeb ok") var corsOption = { origin: 'http://zooprocess.imev-mer.fr', optionSuccessStatus: 200 // for legacy browser @@ -213,13 +216,19 @@ var corsOption = { // app.use (cors(corsOption)) app.use(cors()) +// console.log("cors ok") + // 1. Install bodyParsers for the request types your API will support app.use(express.urlencoded({ extended: false })); app.use(express.text()); app.use(express.json()); +// console.log("bodyParsers ok") + app.use(logger('dev')); +// console.log("logger ok") + app.use('/spec', express.static(apiSpec)); app.use(verifyToken) @@ -227,6 +236,8 @@ app.use(extractJWT) app.use(getRole) // app.use(isRoleAllowed) +// console.log("verifyToken ok") + // 2. Install the OpenApiValidator middleware app.use( openApiMiddleware({