From 49af555da344b102548fbcfe37e1071a9ee6fedf Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Sun, 10 Oct 2021 15:58:31 -0400 Subject: [PATCH] Allow OPTIONS method for CORS preflight req --- utils/protectedRoutes.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/utils/protectedRoutes.js b/utils/protectedRoutes.js index 8506af51..35e52ea4 100644 --- a/utils/protectedRoutes.js +++ b/utils/protectedRoutes.js @@ -25,7 +25,16 @@ module.exports = { "/api/encryption/exchange": true }, PUT: {}, - DELETE: {} + DELETE: {}, + // Preflight request (CORS) + get OPTIONS() { + return { + ...this.POST, + ...this.GET, + ...this.PUT, + ...this.DELETE + } + } }, sensitiveRoutes: { GET: {},