Custom Functions
Build business logic once and reuse it in multiple places
Last updated
Build business logic once and reuse it in multiple places
Last updated
Quick Summary
Custom functions are very similar to your APIs — they have inputs, a function stack, and a response. However, they can not be called externally. Instead, custom functions allow you to build something and use it in other places, while maintaining it in a centralized location.
Custom functions can be thought of as a building block for the rest of your backend. You can build a custom function just like an API endpoint, and insert that custom function into other function stacks, giving you easily reusable logic while only having to maintain it in one place. When you make a change inside of a custom function, that change is automatically in effect everywhere you have chosen to use the custom function.
Give your custom function a name, description, tags, and choose your request history settings.
When you're done, click .
When you're ready to use your new custom function in other function stacks, click , choose Custom Functions from the panel that opens, and select your custom function.
You'll be able to supply data for any inputs the custom function is expecting here.
Name
The name of the custom function.
Description
An internal description, just for you.
Tags
Use tags to organize objects throughout your Xano workspace and find them later
Request History
Inherit Settings
Use whatever is set in your workspace branch defaults
Other
Set specific request history settings for this function
Response caching
Cache the response and redeliver it during future runs 📖 Learn more about response caching
The inputs are anything that a function stack needs to run. For example, a function stack that logs in a user probably needs a username or email and a password; these would be the inputs.
Once the function stack has done its job, it needs to know what to return. This lives in the Response section.
This is where all of the magic happens. All of the different steps and functions that are performed inside of a function stack happen here.