@lelouchB the code above is referencing a param (i.e. :path*
in the arguments to servestatic
) that isn’t in the route specified by the first argument to .get
notice the https://developer.moovweb.com/guides/cookbook#section_serving_a_static_file has something like this (slight changed for illustration purposes):
router.get('/assets/:path*', ({ serveStatic, cache }) => {
cache({
edge: {
maxAgeSeconds: 60 * 60 * 24, // cache at the edge for 24 hours
},
browser: {
maxAgeSeconds: 60 * 60 * 24, // cache for 24 hours
},
})
serveStatic('special/assets/:path*')
})
the above code is basically saying if a GET request comes in for /assets/foo/bar
, then extract the foo/bar
part into the :path*
variable. Then later on the servestatic
fetches the file at special/assets/:path*
, which in this case becomes special/assets/foo/bar
.
In your code serverstatic
had a :path*
variable but the parent route in the .get
call did not.
you likely just want to change your .get
call to match. something like:
.get("/:path*", ({ serveStatic, cache }) => {