Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 4ff9d54

Browse files
committed
Fix CORS error
1 parent 6237b76 commit 4ff9d54

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,17 @@ Configuration can be set using environment variables. Defaults are set in `src/c
8686
- NGN to KES
8787
- KES to USD
8888
- USD to KES
89+
8990
- KES to USDC
9091
- KES to USD
9192
- NGN to GHS
9293
- BTC to NGN
94+
9395
- USD to EUR
9496
- EUR to USD
9597
- USD to GBP
9698
- USD to BTC
99+
97100
- EUR to USD
98101
- EUR to USDC
99102
- USD to EUR

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"@web5/dids": "1.1.1",
99
"ajv": "8.12.0",
1010
"cborg": "^3.0.0",
11+
"cors": "^2.8.5",
1112
"dotenv": "16.3.1",
1213
"express": "4.19.2",
1314
"fuzzysort": "^2.0.4",

src/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { requestCredential } from './credential-issuer.js'
1414
import { NextFunction } from 'express-serve-static-core'
1515
import { InMemoryExchangesApi } from './exchanges.js'
1616
import express from 'express'
17+
import cors from 'cors'
1718

1819
console.log('"AquaFinance Capital" launched: ', config.pfiDid[0].uri)
1920
console.log('"SwiftLiquidity Solutions" launched: ', config.pfiDid[1].uri)
@@ -226,6 +227,9 @@ const issuerPort = 3001
226227

227228
issuerApi.use(snooper())
228229

230+
// Allow cross-origin requests
231+
issuerApi.use(cors())
232+
229233
issuerApi.get('/', (req, res) => {
230234
res.send(
231235
'Please make a get request to /kcc?name=yourname&country=yourcountry&did=yourdid to get a credential',

0 commit comments

Comments
 (0)