DEPRECATED Use https://www.val.town/x/jxnblk/val-town-badge instead
Add a Val Town badge to your own HTTP vals
import.meta.url to link to your valimport wrapper from "https://esm.town/v/jxnblk/valTownBadgeMiddleware";
async function handler(req: Request): Promise<Response> {
const html = `
<h1>Hello, world</h1>
`;
return new Response(html, {
headers: {
"Content-Type": "text/html; charset=utf-8",
},
});
}
export default wrapper(handler, import.meta.url);
import valTownBadge from "https://esm.town/v/jxnblk/valTownBadge";
export default async function(req: Request): Promise<Response> {
const badge = valTownBadge(import.meta.url);
const html = `
<h1>Hello, world</h1>
${badge}
`;
return new Response(html, {
headers: {
"Content-Type": "text/html; charset=utf-8",
},
});
}
You can also edit the snippet below to manually add the badge in HTML
<a href="https://www.val.town/v/jxnblk/valTownBadgeExample" target="_blank" style="text-decoration:none;color:inherit"> <img src="https://jxnblk-valtownbadgesvg.web.val.run/" width="160" height="160"> </a>
Or markdown:
[](https://www.val.town/v/jxnblk/valTownBadgeExample)
import.meta.url to create a link to your valMigrated from folder: _LEAVE_AS_IS/badge_LEAVE_AS_IS/valTownBadge