Updated CORS options.

This commit is contained in:
Mike Cao 2022-03-10 11:49:47 -08:00
parent 3e8dd815b7
commit 48db7708de

View File

@ -3,6 +3,11 @@ import { getSession } from './session';
import { getAuthToken } from './auth';
import { unauthorized, badRequest, serverError } from './response';
const corsOptions = {
origin: '*',
credentials: true,
};
export function createMiddleware(middleware) {
return (req, res) =>
new Promise((resolve, reject) => {
@ -15,7 +20,7 @@ export function createMiddleware(middleware) {
});
}
export const useCors = createMiddleware(cors());
export const useCors = createMiddleware(cors(corsOptions));
export const useSession = createMiddleware(async (req, res, next) => {
let session;