Update CORS

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-07-08 18:57:41 +01:00
parent 08de9bcbc1
commit 681cf873dd

7
app.js
View File

@ -14,8 +14,8 @@ const app = express();
// Middleware
const compression = require('compression');
const rateLimit = require('express-rate-limit');
const authenticate= require('./src/middlewares/auth.middlewares');
const cors = require('cors');
const authenticate= require('./src/middlewares/auth.middlewares');
// Internal Requires
const log = require('./src/utils/log.utils');
@ -62,7 +62,10 @@ app.use((err, req, res, next) => {
});
// Global Middleware:
app.use(cors()); // Allow access from any origin
app.use(cors({
origin: [/\.owlboard\.info$/, 'localhost'],
methods:'GET,POST,OPTIONS'
}));
app.use(express.json()); //JSON Parsing for POST Requests
app.use(compression()); // Compress API Data if supported by client
app.use(limiter);