Skip to content

Commit

Permalink
Include fastify/cors on CLI for serve invocation (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
uditdc authored Sep 26, 2023
1 parent 4ec58cc commit 0cc43f3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"license": "ISC",
"dependencies": {
"@cosmjs/launchpad": "^0.27.1",
"@fastify/cors": "^8.3.0",
"@fastify/rate-limit": "^7.6.0",
"@iarna/toml": "^2.2.5",
"@types/node": "^18.0.3",
Expand Down
2 changes: 2 additions & 0 deletions src/commands/function/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export const run = async (options: any) => {
timeWindow: '1 minute'
})

await fastify.register(import('@fastify/cors'))

fastify.all("*", async (request, reply) => {
let qs = ''
let headerString = ''
Expand Down
2 changes: 2 additions & 0 deletions src/commands/sites/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export const run = async (options: any) => {
timeWindow: '1 minute'
})

await fastify.register(import('@fastify/cors'))

fastify.get("*", async (request, reply) => {
let qs = ''
let headerString = ''
Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@
ajv-formats "^2.1.1"
fast-uri "^2.0.0"

"@fastify/cors@^8.3.0":
version "8.4.0"
resolved "https://registry.yarnpkg.com/@fastify/cors/-/cors-8.4.0.tgz#dc518a5c147141e21d2dd47108ec9ab0bb9b821c"
integrity sha512-MlVvMTenltToByTpLwlWtO+7dQ3l2J+1OpmGrx9JpSNWo1d+dhfNCOi23zHhxdFhtpDzfwGwCsKu9DTeG7k7nQ==
dependencies:
fastify-plugin "^4.0.0"
mnemonist "0.39.5"

"@fastify/deepmerge@^1.0.0":
version "1.1.0"
resolved "https://registry.npmjs.org/@fastify/deepmerge/-/deepmerge-1.1.0.tgz"
Expand Down Expand Up @@ -1372,6 +1380,13 @@ mkdirp@^0.5.6:
dependencies:
minimist "^1.2.6"

[email protected]:
version "0.39.5"
resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.39.5.tgz#5850d9b30d1b2bc57cc8787e5caa40f6c3420477"
integrity sha512-FPUtkhtJ0efmEFGpU14x7jGbTB+s18LrzRL2KgoWz9YvcY3cPomz8tih01GbHwnGk/OmkOKfqd/RAQoc8Lm7DQ==
dependencies:
obliterator "^2.0.1"

[email protected]:
version "2.0.0"
resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
Expand Down Expand Up @@ -1439,6 +1454,11 @@ object-assign@^4.1.0:
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==

obliterator@^2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816"
integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==

on-exit-leak-free@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.0.tgz"
Expand Down

0 comments on commit 0cc43f3

Please sign in to comment.