mirror of
https://github.com/Floriansylvain/ParisMuseesQuizz.git
synced 2026-08-19 11:43:22 +02:00
Fixed base path api
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## Environment variable
|
## Environment variable
|
||||||
|
|
||||||
- API_PORT
|
- API_PORT
|
||||||
|
- API_BASE_PATH
|
||||||
- FRONT_ORIGIN
|
- FRONT_ORIGIN
|
||||||
- JWT_SECRET
|
- JWT_SECRET
|
||||||
- MYSQL_ROOT_PASSWORD
|
- MYSQL_ROOT_PASSWORD
|
||||||
|
|||||||
+3
-4
@@ -37,6 +37,7 @@ function initEnvVariables(): void {
|
|||||||
"FRONT_ORIGIN",
|
"FRONT_ORIGIN",
|
||||||
"JWT_SECRET",
|
"JWT_SECRET",
|
||||||
"PARISMUSEES_SECRET",
|
"PARISMUSEES_SECRET",
|
||||||
|
"API_BASE_PATH",
|
||||||
]
|
]
|
||||||
|
|
||||||
varsToCheck.forEach((varName) => {
|
varsToCheck.forEach((varName) => {
|
||||||
@@ -65,13 +66,11 @@ export function initServer(): express.Express {
|
|||||||
appRouter.use("/session/", sessionRouter)
|
appRouter.use("/session/", sessionRouter)
|
||||||
appRouter.use("/paintings/", paintingsRouter)
|
appRouter.use("/paintings/", paintingsRouter)
|
||||||
|
|
||||||
app.use("/v1/", appRouter)
|
app.use(process.env.API_BASE_PATH + "/", appRouter)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
export function startServer(app: express.Express): void {
|
export function startServer(app: express.Express): void {
|
||||||
app.listen(process.env.API_PORT, () =>
|
app.listen(process.env.API_PORT, () => console.log(`Listening on port ${process.env.API_PORT}`))
|
||||||
console.log(`Listening on port ${process.env.API_PORT}`)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user