File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,10 +3,20 @@ import bodyParser from "body-parser";
33import dotenv from "dotenv" ;
44import crypto from "crypto" ;
55import pkg from "pg" ;
6+ import cors from "cors" ;
67
78dotenv . config ( ) ;
9+
810const { Pool } = pkg ;
9- const app = express ( ) ;
11+ const app = express ( ) ;
12+
13+ app . use (
14+ cors ( {
15+ origin : process . env . WEBSITE_URL ,
16+ methods : [ "GET" , "POST" , "OPTIONS" ] ,
17+ allowedHeaders : [ "Content-Type" , "Authorization" ] ,
18+ } )
19+ ) ;
1020app . use ( bodyParser . json ( ) ) ;
1121
1222const pool = new Pool ( { connectionString : process . env . DATABASE_URL } ) ;
Original file line number Diff line number Diff line change 88 "license" : " MIT" ,
99 "dependencies" : {
1010 "body-parser" : " ^1.20.2" ,
11+ "cors" : " ^2.8.5" ,
1112 "crypto" : " ^1.0.1" ,
1213 "dotenv" : " ^16.3.1" ,
1314 "express" : " ^4.18.2" ,
Original file line number Diff line number Diff line change @@ -76,6 +76,14 @@ cookie@0.7.1:
7676 resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9"
7777 integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==
7878
79+ cors@^2.8.5 :
80+ version "2.8.5"
81+ resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
82+ integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
83+ dependencies :
84+ object-assign "^4"
85+ vary "^1"
86+
7987crypto@^1.0.1 :
8088 version "1.0.1"
8189 resolved "https://registry.yarnpkg.com/crypto/-/crypto-1.0.1.tgz#2af1b7cad8175d24c8a1b0778255794a21803037"
@@ -340,6 +348,11 @@ negotiator@0.6.3:
340348 resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
341349 integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
342350
351+ object-assign@^4 :
352+ version "4.1.1"
353+ resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
354+ integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
355+
343356object-inspect@^1.13.3 :
344357 version "1.13.4"
345358 resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213"
@@ -587,7 +600,7 @@ utils-merge@1.0.1:
587600 resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
588601 integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
589602
590- vary@~1.1.2 :
603+ vary@^1, vary@ ~1.1.2 :
591604 version "1.1.2"
592605 resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
593606 integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==
You can’t perform that action at this time.
0 commit comments