File tree 1 file changed +1
-19
lines changed
1 file changed +1
-19
lines changed Original file line number Diff line number Diff line change @@ -8,33 +8,15 @@ const ProductData=require("./modals/productData")
8
8
const News = require ( "./modals/news" ) ;
9
9
const cron = require ( 'node-cron' ) ;
10
10
const axios = require ( 'axios' ) ;
11
- const whitelist = [ 'https://score-keper.netlify.app' ] ;
12
11
13
12
// Create an Express app
14
13
const app = express (
15
- { cors :{ origin : function ( origin , callback ) {
16
- if ( whitelist . indexOf ( origin ) !== - 1 ) {
17
- callback ( null , true ) ;
18
- } else {
19
- callback ( new Error ( 'Not allowed by CORS' ) ) ;
20
- }
21
- } ,
14
+ { cors :{ origin :"*" ,
22
15
methods : [ "GET" , "POST" , "DELETE" ] ,
23
16
allowedHeaders : [ "Content-Type" ] ,
24
17
credentials : true } }
25
18
) ;
26
19
27
- app . use ( ( req , res , next ) => {
28
- const referringDomain = req . get ( 'Referer' ) ;
29
- const allowedDomain = 'https://score-keper.netlify.app' ;
30
-
31
- if ( referringDomain && referringDomain . startsWith ( allowedDomain ) ) {
32
- next ( ) ;
33
- } else {
34
- res . status ( 403 ) . send ( 'Unauthorized' ) ;
35
- }
36
- } ) ;
37
-
38
20
app . use ( cors ( ) ) ;
39
21
app . use ( express . json ( ) ) ;
40
22
You can’t perform that action at this time.
0 commit comments