forked from noxious/server
CORS fix
This commit is contained in:
parent
cf954979c5
commit
719c75616e
@ -27,11 +27,12 @@ export class Server {
|
|||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.app = express()
|
this.app = express()
|
||||||
this.app.use(
|
this.app.use(cors({
|
||||||
cors({
|
origin: config.CLIENT_URL,
|
||||||
origin: config.CLIENT_URL // Allow CORS from the client URL
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], // Add supported methods
|
||||||
})
|
allowedHeaders: ['Content-Type', 'Authorization'], // Add allowed headers
|
||||||
)
|
credentials: true // Enable if you're using cookies/credentials
|
||||||
|
}))
|
||||||
this.app.use(express.json())
|
this.app.use(express.json())
|
||||||
this.app.use(express.urlencoded({ extended: true }))
|
this.app.use(express.urlencoded({ extended: true }))
|
||||||
this.http = httpServer(this.app)
|
this.http = httpServer(this.app)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user