Skip to content

Commit

Permalink
add origin * for cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Sep 24, 2024
1 parent 76b7c21 commit c8608e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"aws-sdk": "^2.1371.0",
"bcrypt": "^5.0.1",
"cors": "^2.8.5",
"dotenv": "^16.0.1",
"expo-server-sdk": "^3.6.0",
"express": "^4.17.1",
Expand Down
5 changes: 5 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require('./config/db').then(() => {
});

const app = require('express')();
const cors = require('cors')
const port = process.env.PORT || 3000;

const UserRouter = require('./routes/User')
Expand Down Expand Up @@ -375,6 +376,10 @@ if (process.env.NO_HTTPS) {
});
}

server.use(cors({
origin: '*'
}))


const handlePopularPosts = () => {
handlerStatus = popularPostHandler();
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ core-util-is@~1.0.0:
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=

cors@~2.8.5:
cors@^2.8.5, cors@~2.8.5:
version "2.8.5"
resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz"
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
Expand Down

0 comments on commit c8608e0

Please sign in to comment.