Skip to content

Commit

Permalink
Introduce CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed May 29, 2022
1 parent 9277a5b commit 028d7d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author": "lucemans <[email protected]>",
"license": "GPL-3.0",
"dependencies": {
"@fastify/cors": "^7.0.0",
"@lvksh/logger": "^1.6.0",
"@sentry/node": "^6.17.3",
"@sentry/tracing": "^6.17.3",
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Cors from '@fastify/cors';
import chalk from 'chalk';
import { config } from 'dotenv';
import { fastify } from 'fastify';
Expand Down Expand Up @@ -61,6 +62,10 @@ export const StorageBackend: GenericStorage = new SignalStorage();

log.lifecycle('Starting Express');

server.register(Cors, {
origin: true,
allowedHeaders: ['GET', 'PUT', 'POST'],
});
server.register(CreateRoute, { prefix: '/deployments' });
server.register(ApiRoute, { prefix: '/api' });
server.register(GenericRoute);
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@
dependencies:
text-decoding "^1.0.0"

"@fastify/cors@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@fastify/cors/-/cors-7.0.0.tgz#c67c5a5909498b696bb19578e903f36037ac6f32"
integrity sha512-nlo6ScwagBNJacAZD3KX90xjWLIoV0vN9QqoX1wUE9ZeZMdvkVkMZCGlxEtr00NshV0X5wDge4w5rwox7rRzSg==
dependencies:
fastify-plugin "^3.0.0"
vary "^1.1.2"

"@humanwhocodes/config-array@^0.9.2":
version "0.9.2"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.2.tgz#68be55c737023009dfc5fe245d51181bb6476914"
Expand Down Expand Up @@ -4705,7 +4713,7 @@ varint@^6.0.0:
resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0"
integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==

vary@~1.1.2:
vary@^1.1.2, vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
Expand Down

0 comments on commit 028d7d8

Please sign in to comment.