You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-07 23:23:49 +02:00
improving routing. injecting user information to client side to prevent false routing
This commit is contained in:
@@ -5,15 +5,24 @@ import {RenderingMWs} from "../middlewares/RenderingMWs";
|
||||
export class ErrorRouter{
|
||||
constructor(private app) {
|
||||
|
||||
this.addError();
|
||||
this.addApiErrorHandler();
|
||||
}
|
||||
|
||||
private addError() {
|
||||
private addApiErrorHandler() {
|
||||
this.app.use("/api/*",
|
||||
RenderingMWs.renderError
|
||||
);
|
||||
};
|
||||
|
||||
private addGenericHandler() {
|
||||
this.app.use((err, req, res, next) => {
|
||||
res.status(500).send('Houston, we have a problem!');
|
||||
|
||||
//Flush out the stack to the console
|
||||
console.error(err.stack);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user