Skip to content

Commit

Permalink
fix(cors): allow client to access api
Browse files Browse the repository at this point in the history
  • Loading branch information
prajwalbhatia committed Apr 8, 2024
1 parent de3aa2f commit 975a531
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ app.use(morgan('dev'))
//Middlewares
app.use(bodyParser.json({ limit: "3mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "3mb", extended: true }));
app.use(cookieParser.default())

let domains = ['http://192.168.29.23:3000' , 'http://192.168.1.49:3000', 'http://localhost:3000', 'https://habstreak-preprod.netlify.app', 'https://habstreak.com'];

app.use(cors({
origin: domains
}));
app.use(cookieParser.default());

let domains = [
"http://192.168.29.23:3000",
"http://192.168.1.49:3000",
"http://localhost:3000",
"https://habstreak-preprod.netlify.app",
"https://habstreak.com",
];

app.use(
cors({
origin: domains,
credentials : true
})
);

app.options('*', cors())

Expand Down

0 comments on commit 975a531

Please sign in to comment.