fix: update CORS to use site's origin on production (#140)
* fix: update CORS to use site's origin on production * fix: checking CORS preview mode
This commit is contained in:
parent
acd29e95cf
commit
1b5389e06c
|
@ -1,3 +1,4 @@
|
|||
NODE_ENV=development
|
||||
MONGO_DB=mongodb://localhost:27017/urlMinify
|
||||
SECRET=secret
|
||||
AUTH_SECRET=secret
|
|
@ -10,9 +10,15 @@ 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://url-minify-git-fork-olaleye-blessing-fixurlminified-bravo68web.vercel.app'
|
||||
: 'https://minfy.xyz',
|
||||
})
|
||||
)
|
||||
|
||||
app.use(json())
|
||||
app.use(
|
||||
|
|
Loading…
Reference in New Issue