[SolidStart] Add another static file directory

What is the easiest way to add another static file directory like /public?
SolidStart app.config.ts says it configures Vinxi: https://docs.solidjs.com/solid-start/reference/entrypoints/app-config And Vinxi has a "static" option: https://vinxi.vercel.app/api/router/static.html Although defineConfig seems to have plenty of TypeScript support, and SolidStart says this will work, I can't figure out where to configure this additional path in vinxi in app.config.ts. Alternativly, I started to use the npm serve package in middleware.ts but I got hung up on what to return (serve takes the request and response and does not return any value, so I can't tell SolidStart's middle ware to stop processing requests I am done).
app.config.ts - Solid Docs
Documentation for SolidJS, the signals-powered UI framework
Static Router API | Vinxi
Vinxi Documentation
3 Replies
slim (jamesc)
slim (jamesc)OP4mo ago
Another option: https://h3.dev/examples/serve-static-assets#read-files ... But serveStatic returns a boolean. Does SolidStart expose the h3 app? I don't think middleware.ts is going to work well for this.
Static Assets - h3
Serve static assets such as HTML, images, CSS, JavaScript, etc.
slim (jamesc)
slim (jamesc)OP4mo ago
That works, thank you. Also, it dawned on me later that routes like GET are probably powerful enough to do this sort of thing and with a direct request / response object I can likely put middleware in there. I can make-use of cookie information in that regard. publicAssets is certainly the simpilists. To be clear, in solidstart the app.config.ts property is server.publicAssets

Did you find this page helpful?