Instead of doing all this, you can just put the files under your public
directory. If you add the file:
myApp/public/images/kitten.png
You can access it from your templates like:
<img src="/images/kitten.png">
No routes are needed to make that work.
Beware of overlooking the lead slash.
<img src="images/kitten.png">
the above example will work from your top level routes like /books which makes it easy to miss, but fail on /books/pages.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…