@@ -10,7 +10,7 @@ const authServiceUrl = process.env.AUTH_SERVICE_URL || "http://localhost:8002";
10
10
const userServiceUrl = process . env . USER_SERVICE_URL || "http://localhost:8001" ;
11
11
const questionServiceUrl =
12
12
process . env . QUESTION_SERVICE_URL || "http://localhost:8003" ;
13
- const statsServiceUrl = process . env . AUTH_SERVICE_URL || "http://localhost:8004" ;
13
+ const statsServiceUrl = process . env . STATS_SERVICE_URL || "http://localhost:8004" ;
14
14
15
15
app . use ( cors ( ) ) ;
16
16
app . use ( express . json ( ) ) ;
@@ -112,10 +112,9 @@ app.post("/saveGame", async (req, res) => {
112
112
}
113
113
} ) ;
114
114
115
- app . get ( "/getstats " , async ( req , res ) => {
115
+ app . get ( "/ranking " , async ( req , res ) => {
116
116
try {
117
- // Forward the stats request to the stats service
118
- const statsResponse = await axios . get ( userServiceUrl + "/getstats" , {
117
+ const statsResponse = await axios . get ( statsServiceUrl + "/ranking" , {
119
118
params : req . query ,
120
119
} ) ;
121
120
res . json ( statsResponse . data ) ;
@@ -126,21 +125,6 @@ app.get("/getstats", async (req, res) => {
126
125
}
127
126
} ) ;
128
127
129
- app . post ( "/userSaveGame" , async ( req , res ) => {
130
- try {
131
- // Forward the save game request to the stats service
132
- const gameResponse = await axios . post (
133
- userServiceUrl + "/userSaveGame" ,
134
- req . body
135
- ) ;
136
- res . json ( gameResponse . data ) ;
137
- } catch ( error ) {
138
- res
139
- . status ( error . response . status )
140
- . json ( { error : error . response . data . error } ) ;
141
- }
142
- } ) ;
143
-
144
128
// Start the gateway service
145
129
const server = app . listen ( port , ( ) => {
146
130
console . log ( `Gateway Service listening at http://localhost:${ port } ` ) ;
0 commit comments