diff --git a/app.js b/app.js index 89604f3..24a005e 100644 --- a/app.js +++ b/app.js @@ -15,6 +15,7 @@ const app = express(); const compression = require('compression'); const rateLimit = require('express-rate-limit'); const authenticate= require('./src/middlewares/auth.middlewares'); +const cors = require('cors'); // Internal Requires const log = require('./src/utils/log.utils'); @@ -64,6 +65,9 @@ app.use((err, req, res, next) => { }); // Global Middleware: +app.use(cors({ + origin: 'https://svelte.owlboard.info' +})); // Allow test site origins access to API app.use(express.json()); //JSON Parsing for POST Requests app.use(compression()); // Compress API Data if supported by client app.use(limiter); diff --git a/package-lock.json b/package-lock.json index c4cf845..0896a14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "axios": "^1.2.1", "compression": "^1.7.4", + "cors": "^2.8.5", "express": "^4.18.2", "express-rate-limit": "^6.7.0", "html-minifier": "^4.0.0", @@ -1767,6 +1768,18 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2961,6 +2974,14 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", diff --git a/package.json b/package.json index 6badffc..339b3ff 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "dependencies": { "axios": "^1.2.1", "compression": "^1.7.4", + "cors": "^2.8.5", "express": "^4.18.2", "express-rate-limit": "^6.7.0", "html-minifier": "^4.0.0",