fix: update CORS to use site's origin on production
This commit is contained in:
parent
430c6f08ad
commit
2fe682aff3
|
@ -1,3 +1,4 @@
|
|||
NODE_ENV=development
|
||||
MONGO_DB=mongodb://localhost:27017/urlMinify
|
||||
SECRET=secret
|
||||
AUTH_SECRET=secret
|
|
@ -10,9 +10,14 @@ require('dotenv').config()
|
|||
const app = express()
|
||||
|
||||
app.use(express.json())
|
||||
app.use(cors({
|
||||
origin: 'http://localhost:3000'
|
||||
}));
|
||||
app.use(
|
||||
cors({
|
||||
origin:
|
||||
process.env.NODE_ENV?.trim() === 'development'
|
||||
? 'http://localhost:3000'
|
||||
: 'https://minfy.xyz',
|
||||
})
|
||||
)
|
||||
|
||||
app.use(json())
|
||||
app.use(
|
||||
|
|
Loading…
Reference in New Issue