tmcw-nhttpexample.web.val.run
Readme

nhttp example

This uses the tiny nhttp framework with the Val Town Web API. New frameworks like nhttp works really well with our system because they rely on the standard Request & Response objects!

Server examples

1
2
3
4
5
6
7
8
9
10
11
export const nhttpExample = async (request) => {
const { nhttp } = await import("npm:nhttp-land@1");
const app = nhttp();
app.get("/", () => {
return "Hello, World";
});
app.get("/cat", () => {
return { name: "cat" };
});
return app.handleRequest(request);
};
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!
October 23, 2023