mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-13 21:12:59 +01:00
Reddirect 404erro only on dev
This commit is contained in:
parent
bd444ad8d6
commit
f6db3499a4
@ -21,9 +21,9 @@ app.use(
|
|||||||
|
|
||||||
app.set("port", process.env.PORT || 3000);
|
app.set("port", process.env.PORT || 3000);
|
||||||
|
|
||||||
app.use(
|
// app.use(
|
||||||
morgan("dev", { stream: { write: (message) => logger.debug(message) } })
|
// morgan("dev", { stream: { write: (message) => logger.debug(message) } })
|
||||||
);
|
// );
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: false }));
|
app.use(express.urlencoded({ extended: false }));
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
@ -35,13 +35,14 @@ app.use("/v2/api/", apiV2Router);
|
|||||||
Error handler
|
Error handler
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
// catch 404 and forward to error handler
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
next(createError(404));
|
|
||||||
});
|
|
||||||
|
|
||||||
// error handler
|
// error handler
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (app.get("env") == "development") {
|
||||||
|
// catch 404 and forward to error handler
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
next(createError(404));
|
||||||
|
});
|
||||||
|
|
||||||
// only use in development
|
// only use in development
|
||||||
app.use(errorHandler());
|
app.use(errorHandler());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user