Skip to content

Commit f474095

Browse files
authored
docs: Reference to doGet should be onGet (#799)
1 parent 5046c4e commit f474095

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/docs/src/pages/qwikcity/endpoint/data.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ The first step is to layout out the files so that we can accept `https://example
2020

2121
## Implement Endpoint
2222

23-
An endpoint is a `doGet` function that retrieves data (typically from a database, or other stores.) The retrieved data can be returned directly as JSON or used as an input to the component to render HTML. The `doGet` function receives the `params` to extract the parameters used to do data lookup.
23+
An endpoint is a `onGet` function that retrieves data (typically from a database, or other stores.) The retrieved data can be returned directly as JSON or used as an input to the component to render HTML. The `onGet` function receives the `params` to extract the parameters used to do data lookup.
2424

25-
The `doGet` function returns an object that contains:
25+
The `onGet` function returns an object that contains:
2626
- `status`: HTTP status code
2727
- `headers`: HTTP headers to control caches etc...
2828
- `body`: The body of the response to be returned as JSON or to be used as input to the HTML.
@@ -56,7 +56,7 @@ export const onGet: EndpointHandler<EndpointData> = async ({ params }) => {
5656

5757
## Using Endpoint in Component
5858

59-
An endpoint `doGet` function retrieves data and makes it available as JSON. The next step is to convert the JSON to HTML. This is done with a standard component as described [Components](/qwikcity/content/component). What is new is `useEndpoint()` to retrieve the data from the `doGet` function.
59+
An endpoint `onGet` function retrieves data and makes it available as JSON. The next step is to convert the JSON to HTML. This is done with a standard component as described [Components](/qwikcity/content/component). What is new is `useEndpoint()` to retrieve the data from the `onGet` function.
6060

6161
```typescript
6262
import { Resource, component$, Host, useStore } from '@builder.io/qwik';
@@ -85,9 +85,9 @@ export default component$(() => {
8585
});
8686
```
8787

88-
1. Notice that the data endpoint and the component are defined in the same file. The data endpoint is serviced by the `doGet` function and the component is by the modules default export.
89-
2. The component uses `useEndpoint()` function to retrieve the data. The `useEndpoint()` function invokes `doGet` function directly on the server but using `fetch()` on the client. Your component does not need to think about server/client differences when using data. The `useEndpoint()` function returns an object of type `Resource`. `Resource`s are promise-like objects that can be serialized by Qwik.
90-
3. The `doGet` function is invoked before the component. This allows the `doGet` to return 404 or redirect in case the data is not available.
88+
1. Notice that the data endpoint and the component are defined in the same file. The data endpoint is serviced by the `onGet` function and the component is by the modules default export.
89+
2. The component uses `useEndpoint()` function to retrieve the data. The `useEndpoint()` function invokes `onGet` function directly on the server but using `fetch()` on the client. Your component does not need to think about server/client differences when using data. The `useEndpoint()` function returns an object of type `Resource`. `Resource`s are promise-like objects that can be serialized by Qwik.
90+
3. The `onGet` function is invoked before the component. This allows the `onGet` to return 404 or redirect in case the data is not available.
9191
4. Notice the use of `<Resource>` JSX element. The purpose of `Resource` is to allow the client to render different states of the `useEndpoint()` resource.
9292
5. On the server the `<Resource>` element will pause rendering until the `Resource` is resolved or rejected. This is because we don't want the server to render `loading...`. (The server needs to know when the component is ready for serialization into HTML.)
9393

packages/docs/src/pages/qwikcity/head/title.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export const head: DocumentHead = (props: DocumentHeadProps<EndpointData>): Reso
5757
};
5858
```
5959

60-
The second case is a bit more complicated but it showcases how we can set the title of the page with the value that is retrieved from the `doGet` endpoint. (See [endpoint documentation](/qwikcity/endpoint/data) for retrieving data.) The Qwik City invokes `doGet` to retrieve the data for the route and then passes the data to the `head` function allowing it to create a custom title.
60+
The second case is a bit more complicated but it showcases how we can set the title of the page with the value that is retrieved from the `onGet` endpoint. (See [endpoint documentation](/qwikcity/endpoint/data) for retrieving data.) The Qwik City invokes `onGet` to retrieve the data for the route and then passes the data to the `head` function allowing it to create a custom title.

0 commit comments

Comments
 (0)