From dfcf88a714f0358f988ad5352ea034a396cddbeb Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Thu, 29 Aug 2024 10:15:27 -0400 Subject: [PATCH 1/2] clarify that only http vals have and endpoint, and how to find it --- src/content/docs/types/http/basic-examples.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/content/docs/types/http/basic-examples.mdx b/src/content/docs/types/http/basic-examples.mdx index fe06cc9..053dc18 100644 --- a/src/content/docs/types/http/basic-examples.mdx +++ b/src/content/docs/types/http/basic-examples.mdx @@ -8,7 +8,9 @@ sidebar: import Val from "@components/Val.astro"; -A val that works with the Web API takes a Request object as input and needs to return a Response object. +HTTP vals, unlike other vals, expose a public endpoint. + +An HTTP val that works with the Web API takes a Request object as input and needs to return a Response object. The most basic example can ignore the request and just return a response, even using a shorthand method like [Response.json, which is part of the web standard](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static). @@ -29,4 +31,6 @@ We can grab query parameters using the web standard [URLSearchParams](https://de You can also get the body of POST requests using the Request object, for example if you had an endpoint that received JSON: - \ No newline at end of file + + +To obtain the HTTP endpoint for your HTTP val, use the "Copy HTTP endpoint" feature (located in the val's sidebar, or in its ⋯ menu) From fba53ef44fb4ba34501f09d5a93d4f4690b41cc7 Mon Sep 17 00:00:00 2001 From: Max McDonnell Date: Thu, 29 Aug 2024 09:25:28 -0500 Subject: [PATCH 2/2] Update basic-examples.mdx --- src/content/docs/types/http/basic-examples.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/types/http/basic-examples.mdx b/src/content/docs/types/http/basic-examples.mdx index 053dc18..0e07d67 100644 --- a/src/content/docs/types/http/basic-examples.mdx +++ b/src/content/docs/types/http/basic-examples.mdx @@ -10,7 +10,7 @@ import Val from "@components/Val.astro"; HTTP vals, unlike other vals, expose a public endpoint. -An HTTP val that works with the Web API takes a Request object as input and needs to return a Response object. +An HTTP val that works with the Web API takes a Request object as input and returns a Response object. The most basic example can ignore the request and just return a response, even using a shorthand method like [Response.json, which is part of the web standard](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static). @@ -33,4 +33,4 @@ for example if you had an endpoint that received JSON: -To obtain the HTTP endpoint for your HTTP val, use the "Copy HTTP endpoint" feature (located in the val's sidebar, or in its ⋯ menu) +To obtain the HTTP endpoint for your HTTP val, use the "Copy HTTP endpoint" feature (located in the val's sidebar, or in its ... menu).