Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

"Code on Val Town" Response modifier

Appends the "Code on Val Town" ribbon to an HTTP Response.

Usage

  • new modifyResponse(res, { handle: "andre", name: "foo" }) - define which val to link to;
  • new modifyResponse(res) - infer the val from the call stack.

Example: @andreterron/openable_res

import { modifyResponse } from "https://esm.town/v/andreterron/codeOnVT_modifyResponse"; import { html } from "https://esm.town/v/stevekrouse/html?v=5"; export default async (req: Request): Promise<Response> => { return modifyResponse(html(` <h2>Hello world!</h2> <style>* { font-family: sans-serif }</style> `)); };

Migrated from folder: A_Features/_24_02_15_Open_In_ValTown/codeOnVT_modifyResponse