mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-12-23 22:46:44 +01:00
Reddirect 404erro only on dev
This commit is contained in:
parent
b671be0e6a
commit
39e2478a03
@ -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