Elderjs / elderjs

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
https://elderguide.com/tech/elderjs/
MIT License
2.11k stars 53 forks source link

How do I render a route / svelte component through node? #96

Closed talha-asad closed 3 years ago

talha-asad commented 3 years ago

I added a function for serving 404 route / template incase of a 404 to polka in server.js like the following:

const server = polka({
  onNoMatch: (req, res, next) => {
    console.log('404 Error: ', req.url);

  }
});

How can I render a regular elderjs route here?

nickreese commented 3 years ago

For ssr look at the middleware hook id you want it through elder.js. It’ll be fiddly but it is totally doable. The docs could use an example... but it is a perfect use case for a plugin.