From 2142948ce865f2f8e9f755aedf6d13cfa3b8e21c Mon Sep 17 00:00:00 2001 From: Benzzick Date: Thu, 27 Aug 2026 13:21:58 +0100 Subject: [PATCH] docs: clarify endpoint names for beginners --- .../version-3.4.0/01-get-started/01-creating-endpoints.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/versioned_docs/version-3.4.0/01-get-started/01-creating-endpoints.md b/versioned_docs/version-3.4.0/01-get-started/01-creating-endpoints.md index 4dc7828d..003ce794 100644 --- a/versioned_docs/version-3.4.0/01-get-started/01-creating-endpoints.md +++ b/versioned_docs/version-3.4.0/01-get-started/01-creating-endpoints.md @@ -106,6 +106,10 @@ $ serverpod generate `serverpod generate` will create bindings for the endpoint and register them in the server's `generated/protocol.dart` file. It will also generate the required client code so that you can call your new `generateRecipe` method from your app. +:::tip Endpoint names become client properties +In the next section you'll call `client.recipe.generateRecipe(...)` — not `client.recipeEndpoint.generateRecipe(...)` or `client.generateRecipe(...)`. That's not a typo: Serverpod derives the property name from your endpoint's class name by dropping the `Endpoint` suffix and lowercasing the first letter, so `RecipeEndpoint` becomes `client.recipe`. Every method you add inside the class shows up under that property, e.g. `client.recipe.generateRecipe(...)`. This mapping is generated automatically by `serverpod generate` above — there's nothing to configure by hand, but it's worth knowing the rule so the client code doesn't feel like it's coming out of nowhere. +::: + :::note When writing server-side code, in most cases, you want it to be _stateless_. This means you avoid using global or static variables. Instead, think of each endpoint method as a function that does stuff in a sub-second timeframe and returns data or a status messages to your client. If you want to run more complex computations, you can return a `Stream` to yield progress updates as your task progresses. ::: @@ -241,4 +245,4 @@ Try out the app by clicking the button to get a new recipe. The app will call th ## Next steps -For now, you are just returning a `String` to the client. In the next section, you will create a custom data model to return structured data. Serverpod makes it easy by handling all the serialization and deserialization for you. +For now, you are just returning a `String` to the client. In the next section, you will create a custom data model to return structured data. Serverpod makes it easy by handling all the serialization and deserialization for you. \ No newline at end of file