vendredi 16 juillet 2021

How to serve a file at a user defined route in Gatsby.js?

my question is essentially as stated in the title.

I have a file that I have access to through a graphql query. It is a pdf file. I want this file to be served at a specific route on my site, for example mysite.com/file.pdf should simply serve the raw contents of this file to the user rather than serving a react component. How could I do this?

I know I could redirect to the file's publicURL but I would like to know if there is someway that I could do this without a redirect? Thanks for your time!




Aucun commentaire:

Enregistrer un commentaire