Readme

See @pomdtr/lastlogin for more informations about the middleware

Example

/** @jsxImportSource npm:hono@3/jsx */ import { lastlogin } from "https://esm.town/v/pomdtr/lastloginHono"; import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail" import { Hono } from "npm:hono"; const app = new Hono(); const lastloginMiddleware = lastlogin({ verifyEmail: verifyUserEmail }); // required for the auth pages to work app.use("/auth/*", lastloginMiddleware); // this page is public app.get("/", async (c) => { return c.html( <div> There is a secret message for you if you{" "}<a href="/secret">login</a> </div>, ); }); // this page requires the user to signup app.get("/secret", lastloginMiddleware, async (c) => { const email = c.req.header("X-User-Email"); return c.html( <div> I think {email} is a really silly email address, actually. </div>, ); }); export default app.fetch;
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
June 6, 2024