move xs-securiry.json
This commit is contained in:
committed by
Daniel Hutzel
parent
ee63541845
commit
64cc4ec26a
@@ -22,7 +22,29 @@ const getFormattedDateTime = () => {
|
||||
return formattedDateTime;
|
||||
};
|
||||
|
||||
const corsMiddleware = (req, res, next) => {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header(
|
||||
"Access-Control-Allow-Methods",
|
||||
"GET, PUT, PATCH, POST, DELETE, OPTIONS"
|
||||
);
|
||||
res.header(
|
||||
"Access-Control-Allow-Headers",
|
||||
"Origin, X-Requested-With, Content-Type, Accept, Authorization, Accept-Language"
|
||||
);
|
||||
|
||||
//intercepts OPTIONS method
|
||||
if ("OPTIONS" === req.method) {
|
||||
//respond with 200
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
//move on
|
||||
next();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getFormattedDateTime,
|
||||
getDurationInMilliseconds,
|
||||
corsMiddleware,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user