-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove fast-glob from project
- Loading branch information
1 parent
d508a22
commit 39ab465
Showing
6 changed files
with
12 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
import type { Express } from "express"; | ||
import { Router } from "express"; | ||
import fg from "fast-glob"; | ||
import { logger } from "../../utils/logger"; | ||
import env from "./env"; | ||
import { refreshTokenRouter } from "../routes/auth/refresh-token-router/refresh-token-router"; | ||
import { signInRouter } from "../routes/auth/sign-in-router/sign-in-router"; | ||
import { signUpRouter } from "../routes/auth/sign-up-router/sign-up-router"; | ||
import { tokenInfoRouter } from "../routes/auth/token-info-router/token-info-router"; | ||
|
||
export const setupRoutes = (app: Express) => { | ||
const router = Router(); | ||
|
||
app.use("/api", router); | ||
|
||
const fileRule = | ||
env.state === "production" | ||
? "**/main/routes/**/**-router/**-router.js" | ||
: "**/src/main/routes/**/**-router/**-router.ts"; | ||
|
||
fg.sync([fileRule]).map(async (file) => { | ||
const fileList = file.split("/"); | ||
// eslint-disable-next-line @typescript-eslint/no-magic-numbers | ||
const index = fileList.length - 1; | ||
logger.info(`Loading the file router ${fileList[index]} ...`); | ||
(await import(`../../../${file}`)).default(router); | ||
}); | ||
refreshTokenRouter(router); | ||
signInRouter(router); | ||
signUpRouter(router); | ||
tokenInfoRouter(router); | ||
}; |
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
39ab465
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
oauth2-0 – ./
oauth2-0-williancacoelho-gmailcom.vercel.app
oauth2-0.vercel.app
oauth2-0-git-master-williancacoelho-gmailcom.vercel.app