Closed akxcv closed 4 years ago
Yup, that would be a great change. We should investigate switching to https://github.com/inhabitedtype/ocaml-dispatch to do this easily though.
@akxcv I believe this has been solved by #152. You can now use Opium_kernel.Static.serve
and provide a read function to serve a file, either by reading the content from the local filesystem or from another source (e.g. Amazon S3).
I'm going to close this now, but don't hesitate to reopen if you have any questions.
Currently, AFAIK, we can only serve static files in Opium by using the
static
middleware. If we want to, say, serve a specific file on a specific route (examples:GET / => index.html
,response code 404 => 404.html
), we have to write the code ourselves.But I guess we could share the code from this file and use it as a helper.
Wouldn't it be nice?