Fixed base path api

This commit is contained in:
Florian Sylvain
2023-03-09 12:55:52 +01:00
parent 2bb42e6aa1
commit 163e5304a9
2 changed files with 4 additions and 4 deletions
+1
View File
@@ -3,6 +3,7 @@
## Environment variable
- API_PORT
- API_BASE_PATH
- FRONT_ORIGIN
- JWT_SECRET
- MYSQL_ROOT_PASSWORD
+3 -4
View File
@@ -37,6 +37,7 @@ function initEnvVariables(): void {
"FRONT_ORIGIN",
"JWT_SECRET",
"PARISMUSEES_SECRET",
"API_BASE_PATH",
]
varsToCheck.forEach((varName) => {
@@ -65,13 +66,11 @@ export function initServer(): express.Express {
appRouter.use("/session/", sessionRouter)
appRouter.use("/paintings/", paintingsRouter)
app.use("/v1/", appRouter)
app.use(process.env.API_BASE_PATH + "/", appRouter)
return app
}
export function startServer(app: express.Express): void {
app.listen(process.env.API_PORT, () =>
console.log(`Listening on port ${process.env.API_PORT}`)
)
app.listen(process.env.API_PORT, () => console.log(`Listening on port ${process.env.API_PORT}`))
}