I put test.html
in the routes
folder, but both localhost:8000/test
and localhost:8000/test.html
redirect me to the 404 page. The documentation Routing | Fresh docs doesn't discuss about this.
Or is it that I must use JS/TS files for routing? My solution so far is to put the file on static
, then inject it to routes/test.tsx
:
export default async function Home() {
const html = await Deno.readTextFile('./static/test.html')
return (
<div
dangerouslySetInnerHTML={{ __html: html }}
/>
);
}
As you can see on the attribute name, this practice is dangerous.
You could try creating a custom route handler that serves the HTML file