2

I'd like to make a custom leaf page when I get 404 in Vapor 3.1.0. I've searched the web for it and even in the docs, I couldn't find out. How could I do it?

Thank you

Quentin C
  • 307
  • 3
  • 13
  • As far as I remember you should build your own middleware and catch 404 error there, and once 404 happens you should return leaf page instead of throwing it to next responder. – imike Mar 21 '19 at 10:17

1 Answers1

2

Check out https://github.com/brokenhandsio/leaf-error-middleware which provides a solution for doing what you want!

Basically it replaces the error middleware and loads up 404.leaf or serverError.leaf for the different errors.

0xTim
  • 5,146
  • 11
  • 23