Step 1: Create Your First Function
-
After Logging In:
- Click on the "Create your first function" button.
-
Fill in the Function Details:
- Name: Enter a name for your function.
- Description: Provide a brief description of what your function does.
- Language: Choose Python.
- Image: Select
python:3.12.1-slim
. - Concurrency: Choose synchronous (sync) so the function returns a result immediately.
- Environment Variables: Add any environment variables your function needs.
- Packages: Add any packages your function requires.
-
Click "Create":
- Once you've filled in the details, click the "Create" button.
Step 2: Write Your Function Code
After creating the function, you will see a code template, replace it with this code:
def handler(request):
return "Hello, World!"
Click on the "Save" button to save your code. More info on how to structure your code can be found here.
Step 3: Run Your Function
- You can now click on the "Run" -> "Post" button to execute the function and see the result.
- Alternatively, you will see a Run URL under the Info tab. You can use this URL to run the function from your browser. Simply go to that URL in your browser to see the output.
Step 4: Share Your Function
- If you want to share your function with others, you can make it public by clicking on the
settings
tab and toggling thepublic
switch. This will generate a public URL that others can use to run your function. - You will find the Share URL under the Info tab.