mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-30 04:44:54 +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.use(
|
||||
morgan("dev", { stream: { write: (message) => logger.debug(message) } })
|
||||
);
|
||||
// app.use(
|
||||
// morgan("dev", { stream: { write: (message) => logger.debug(message) } })
|
||||
// );
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
@ -35,13 +35,14 @@ app.use("/v2/api/", apiV2Router);
|
||||
Error handler
|
||||
----------------------------------------------------------
|
||||
*/
|
||||
// catch 404 and forward to error handler
|
||||
app.use((req, res, next) => {
|
||||
next(createError(404));
|
||||
});
|
||||
|
||||
// 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
|
||||
app.use(errorHandler());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user