Skip to content

Commit

Permalink
feat(backend): add cors for open payments server #2438
Browse files Browse the repository at this point in the history
  • Loading branch information
raducristianpopa authored Feb 23, 2024
1 parent d9188a2 commit 249a4e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@graphql-codegen/typescript-resolvers": "4.0.5",
"@types/koa": "2.14.0",
"@types/koa-bodyparser": "^4.3.12",
"@types/koa__cors": "^5.0.0",
"@types/koa__router": "^12.0.4",
"@types/lodash": "^4.14.202",
"@types/luxon": "^3.4.2",
Expand Down Expand Up @@ -55,6 +56,7 @@
"@interledger/openapi": "1.2.1",
"@interledger/pay": "0.4.0-alpha.9",
"@interledger/stream-receiver": "^0.3.3-alpha.3",
"@koa/cors": "^5.0.0",
"@koa/router": "^12.0.0",
"@opentelemetry/api": "^1.6.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.43.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Koa, { DefaultState } from 'koa'
import bodyParser from 'koa-bodyparser'
import { Logger } from 'pino'
import Router from '@koa/router'
import cors from '@koa/cors'
import { ApolloServer } from '@apollo/server'
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'
import { koaMiddleware } from '@as-integrations/koa'
Expand Down Expand Up @@ -583,6 +584,7 @@ export class App {
walletAddressRoutes.get
)

koa.use(cors())
koa.use(router.routes())

this.openPaymentsServer = koa.listen(port)
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 249a4e6

Please sign in to comment.