Skip to content

Commit 7b35989

Browse files
committed
refactor(app.ts): remove node environment when loggin a 500 error
1 parent 1c6bae0 commit 7b35989

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/app.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,18 @@ app.use("/auth", authRouter);
7878
app.get("*", function(req: express.Request, res: express.Response) {
7979
return res.status(404).redirect("/404");
8080
});
81+
// 500 - Any server error
82+
app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
83+
res.status(err.status || 500);
84+
res.render("error", {
85+
message: err.message,
86+
error: {},
87+
});
88+
});
8189

8290
if (app.get("env") === "development") {
8391
app.use(errorHandler());
8492
app.locals.pretty = true;
8593
}
8694

87-
if (app.get("env") === "production") {
88-
// 500 - Any server error
89-
app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
90-
res.status(err.status || 500);
91-
res.render("error", {
92-
message: err.message,
93-
error: {},
94-
});
95-
});
96-
}
97-
9895
export default app;

src/models/User.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ const userSchema = new mongoose.Schema(
4545
discordId: String,
4646
slackId: String,
4747
token: String,
48-
49-
resetPasswordToken: String,
50-
resetPasswordExpires: Date,
5148
},
5249
{
5350
toJSON: {virtuals: true},

0 commit comments

Comments
 (0)