aboutsummaryrefslogtreecommitdiff
path: root/src/cors
diff options
context:
space:
mode:
authorjosh97josh2018-04-22 17:36:39 +0100
committerjosh97josh2018-04-22 17:36:39 +0100
commitaec20c7e3c9a01dbb073590201b473da5669e8e1 (patch)
tree53df187fd473c1d0ca19568f03995bb462d9f633 /src/cors
parentMerge branch 'jl247/permissions' into trh/gets (diff)
parentautocreating logs folder on startup (diff)
downloadmedicine-aec20c7e3c9a01dbb073590201b473da5669e8e1.tar.gz
medicine-aec20c7e3c9a01dbb073590201b473da5669e8e1.zip

Merge branch ‘trh/gets’ of ssh://localhost:2222/cs3099group-be-4/project-code into trh/gets

Diffstat (limited to 'src/cors')
-rw-r--r--src/cors/index.d.ts15
-rw-r--r--src/cors/index.js8
2 files changed, 23 insertions, 0 deletions
diff --git a/src/cors/index.d.ts b/src/cors/index.d.ts
new file mode 100644
index 0000000..d6e651a
--- /dev/null
+++ b/src/cors/index.d.ts
@@ -0,0 +1,15 @@
+import { NextFunction, Request, Response } from 'express';
+
+export interface CORSOptions {
+ origins?: string[] | Function;
+ methods?: string[];
+ requestHeaders?: string[];
+ responseHeaders?: string[];
+ supportsCredentials?: boolean;
+ maxAge?: number;
+ endPreflightRequests?: boolean;
+}
+
+export const cors: () =>
+ (req: Request, res: Response, next: NextFunction) =>
+ void;
diff --git a/src/cors/index.js b/src/cors/index.js
new file mode 100644
index 0000000..7e21093
--- /dev/null
+++ b/src/cors/index.js
@@ -0,0 +1,8 @@
+const corser = require('corser');
+const cors = corser.create.bind(null, {
+ requestHeaders: corser.simpleRequestHeaders.concat([
+ 'Authorisation',
+ 'Authorization'
+ ])
+});
+module.exports = { cors: cors };