Etag
Simple etag libs.
Import
Deno
import {...} from "https://deno.land/x/nhttp@1.3.26/lib/etag.ts";
Deno npm
import {...} from "npm:nhttp-land@1.3.26/etag";
Node / Bun
import {...} from "nhttp-land/etag";
// or
// const {...} = require("nhttp-land/etag");
Usage
import nhttp from "https://deno.land/x/nhttp@1.3.26/mod.ts";
import etag from "https://deno.land/x/nhttp@1.3.26/lib/etag.ts";
const app = nhttp();
app.use(etag());
app.get("/", () => {
return "Hello With Etag";
});
app.listen(8000);
Sendfile with Etag
import nhttp from "https://deno.land/x/nhttp@1.3.26/mod.ts";
import { sendFile } from "https://deno.land/x/nhttp@1.3.26/lib/etag.ts";
const app = nhttp();
app.get("/", async (rev) => {
await sendFile(rev, "path/to/file.txt");
});
app.listen(8000);