feat: allow cors
This commit is contained in:
parent
65add03cbc
commit
44c14bb324
4 changed files with 36 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
require('./routes')
|
||||
const express = require('express')
|
||||
const cors = require('cors')
|
||||
const { routes } = require('./routes')
|
||||
const { maxAttachmentSize, basePath, trustProxy } = require('./config')
|
||||
|
||||
|
|
@ -16,6 +17,11 @@ if (trustProxy) {
|
|||
app.use(express.json({ limit: maxAttachmentSize + 1000000 }))
|
||||
app.use(express.urlencoded({ limit: maxAttachmentSize + 1000000, extended: true }))
|
||||
|
||||
app.use(cors({
|
||||
origin: process.env.ALLOWED_ORIGINS?.split(',') || '*',
|
||||
credentials: true
|
||||
}))
|
||||
|
||||
// Mount routes with configurable base path
|
||||
app.use(basePath, routes)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue