diff options
| author | unwox <me@unwox.com> | 2025-09-08 13:36:42 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-09-08 15:04:34 +0600 |
| commit | 89fe6e4978e47254ae0c349d02cab6b267e5076f (patch) | |
| tree | 21935d9d44aa39c9239c9027081e56146d3d0da6 /example | |
| parent | dbd1b030b0dc58df7cf86b6f14fa32a93c6f02b6 (diff) | |
allow specifying Cache-Control header for static files
Diffstat (limited to 'example')
| -rw-r--r-- | example/main.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/example/main.lua b/example/main.lua index 335eaad..8cca405 100644 --- a/example/main.lua +++ b/example/main.lua @@ -90,8 +90,9 @@ luna.router.route("GET /request", function () return 200, {}, "Your IP is: " .. response.body end) --- serve static files from static/ directory -luna.router.static("GET /static/", "static/") +-- serve static files from static/ directory. also cache them on the client +-- side for 1 hour. +luna.router.static("GET /static/", "static/", "public, immutable, max-age=3600") -- register a custom eval handler that will evaluate whatever is passed into -- luna stdio when it's run with -D flag. in this case we print the result of |
