Building a web app with Javalin. How do I display a PDF from my staticfiles folder in the app.post function?
I can't use .getResourceAsStream because it has images, and the function couldn't parse it. I can serve html files using ctx.html but can't find similar for PDF. I can find it manually by typing the file name into the address bar but want to serve it automatically.
You can add directory with static files to your Javalin app like this:
Now you can simply redirect in the app.post function:
"/fileName.pdf" - path to your file in "static" folder