1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { isAuthenticated } from "https://esm.town/v/pomdtr/basicAuth";
export default async function(req: Request): Promise<Response> {
if (!await isAuthenticated(req)) {
return new Response("Unauthorized", {
status: 401,
headers: {
"WWW-Authenticate": "Basic",
},
});
}
return new Response("Well played!");
}