diff --git a/apps/api/src/server.ts b/apps/api/src/server.ts index 640da54..41a09cc 100644 --- a/apps/api/src/server.ts +++ b/apps/api/src/server.ts @@ -29,20 +29,23 @@ class App { this.app.use(bodyParser.json()); this.app.use(cookieParser()); this.app.use(cors({ - origin: this.corsOptions + origin: this.corsOptions, + credentials : true, + methods: 'GET,PUT,POST,DELETE,OPTIONS', + allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept, Authorization' })); - this.app.use( (req, res, next) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"); - res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS'); - next(); - }); - this.app.options("/", (req, res) => { - res.setHeader("Access-Control-Allow-Origin", "*"); - res.setHeader("Access-Control-Allow-Methods", "PUT, POST, GET, DELETE, OPTIONS"); - res.setHeader("Access-Control-Allow-Headers", "Content-Type"); - res.sendStatus(204); - }); + // this.app.use( (req, res, next) => { + // res.header("Access-Control-Allow-Origin", "*"); + // res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"); + // res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS'); + // next(); + // }); + // this.app.options("/", (req, res) => { + // res.setHeader("Access-Control-Allow-Origin", "*"); + // res.setHeader("Access-Control-Allow-Methods", "PUT, POST, GET, DELETE, OPTIONS"); + // res.setHeader("Access-Control-Allow-Headers", "Content-Type"); + // res.sendStatus(204); + // }); // this.app.set('trust proxy', 1) // trust first proxy // this.app.use(session({ // secret: process.env.SECRET_TOKEN,