Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
adding cors
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal committed Aug 22, 2023
1 parent c431861 commit 9729ef3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ion/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 ion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dependencies": {
"@decentralized-identity/ion-sdk": "^0.5.0",
"@decentralized-identity/sidetree": "1.0.6-unstable.5e20ddf",
"@koa/cors": "^4.0.0",
"chalk": "4.0.0",
"koa": "2.7.0",
"koa-router": "7.4.0",
Expand Down
4 changes: 4 additions & 0 deletions ion/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const sidetreeCore = new SidetreeCore(config, coreVersions, cas);

const app = new Koa();

// Add open CORS policy.
const cors = require('@koa/cors');
app.use(cors());

// Raw body parser.
app.use(async (ctx, next) => {
ctx.body = await getRawBody(ctx.req);
Expand Down

0 comments on commit 9729ef3

Please sign in to comment.