added cors

This commit is contained in:
SrGooglo 2023-07-06 13:56:59 +00:00
parent 2cf64b5e6b
commit 2a7fd8de3d

View File

@ -7,6 +7,7 @@ import RedisClient from "@shared-classes/RedisClient"
import StorageClient from "@shared-classes/StorageClient"
import CacheService from "@shared-classes/CacheService"
import ComtyClient from "@shared-classes/ComtyClient"
import cors from "cors"
import express from "express"
import pkg from "../package.json"
@ -132,6 +133,12 @@ export default class FileServerAPI {
await this.storage.initialize()
await this.b2Storage.authorize()
this.server.use(cors({
origin: "*",
credentials: true,
preflightContinue: false,
optionsSuccessStatus: 204,
}))
this.server.use(express.json({ extended: false }))
this.server.use(express.urlencoded({ extended: true }))