diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2021-04-17 20:24:07 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2021-04-17 20:24:07 +0200 |
| commit | 0457b6f3579a00f08891825aee1629cbd1443d76 (patch) | |
| tree | 7a047e162b7eac039414b4201c756441b7106ae9 | |
| parent | 6cff1bba7d6be3818547b40cc9965f4b2ba73711 (diff) | |
| download | srht-git-feed-0457b6f3579a00f08891825aee1629cbd1443d76.tar.xz srht-git-feed-0457b6f3579a00f08891825aee1629cbd1443d76.zip | |
Add cache headers
| -rw-r--r-- | index.ts | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -84,13 +84,15 @@ for await (const req of serve({ port: parseInt(SERVER_PORT), hostname: SERVER_HO if (req.url === "/version.txt") { req.respond({ body: await Deno.readTextFile("version.txt") }); } else if (req.url === "/") { - req.respond({ body: JSON.stringify(await getRepositories()) }); + const headers = new Headers(); + headers.append("Cache-Control", "public,no-transform,max-age=3600"); + headers.append("Expires", new Date().toUTCString()); + req.respond({ body: JSON.stringify(await getRepositories()), headers: headers }); } else { req.respond({ status: 404 }); } - } catch(err) { req.respond({ body: JSON.stringify(err) }); } |
