-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from feliciagan/qnhist
Qnhist
- Loading branch information
Showing
24 changed files
with
437 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import axios from "axios"; | ||
import dotenv from "dotenv"; | ||
|
||
dotenv.config(); | ||
|
||
const USER_SERVICE_URL = | ||
process.env.USER_SERVICE_URL || "http://user-service:3001/api"; | ||
|
||
export const userClient = axios.create({ | ||
baseURL: USER_SERVICE_URL, | ||
withCredentials: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
backend/qn-history-service/src/middlewares/basicAccessControl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NextFunction, Response, Request } from "express"; | ||
import { userClient } from "../api/userService"; | ||
|
||
export const verifyToken = ( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction | ||
) => { | ||
const authHeader = req.headers.authorization; | ||
userClient | ||
.get("/auth/verify-token", { headers: { Authorization: authHeader } }) | ||
.then(() => next()) | ||
.catch((err) => { | ||
console.log(err.response); | ||
return res.status(err.response.status).json(err.response.data); | ||
}); | ||
}; |
Oops, something went wrong.