Skip to content

Commit

Permalink
Adding CORS policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ouifi committed Apr 20, 2021
1 parent 9d13261 commit 23bc4db
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
32 changes: 32 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 @@ -17,6 +17,7 @@
"axios": "^0.21.1",
"chalk": "^4.1.0",
"fastify": "^3.14.2",
"fastify-cors": "^5.2.0",
"fastify-helmet": "^5.3.1",
"uuid": "^8.3.2"
},
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fastify = require("fastify");
const fastifyHelmet = require("fastify-helmet");
const fastifyCORS = require("fastify-cors");

const Reddit = require("./lib/reddit");
const { Logger, LOG_LEVELS } = require("./lib/log");
Expand Down Expand Up @@ -32,6 +33,9 @@ if (process.env.NODE_ENV !== "production") {
Server.register(api, { prefix: "/api" });
} else {
Server.register(api);
Server.register(fastifyCORS, {
origin: true
});
}

Reddit.initialize(
Expand Down

0 comments on commit 23bc4db

Please sign in to comment.