Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/waqqas/sample-functions-python-jokes
https://github.com/waqqas/sample-functions-python-jokes
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/waqqas/sample-functions-python-jokes
- Owner: waqqas
- Created: 2023-06-19T14:05:48.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-06-19T14:15:32.000Z (over 1 year ago)
- Last Synced: 2023-08-12T13:59:02.346Z (over 1 year ago)
- Language: Dockerfile
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample Function: Python Joke API
## Introduction
This repository contains a sample joke API function written in Python. You can deploy it on DigitalOcean's App Platform as a Serverless Function component.
Documentation is available at https://docs.digitalocean.com/products/functions.### Requirements
* You need a DigitalOcean account. If you don't already have one, you can sign up at [https://cloud.digitalocean.com/registrations/new](https://cloud.digitalocean.com/registrations/new).
* To deploy from the command line, you will need the [DigitalOcean `doctl` CLI](https://github.com/digitalocean/doctl/releases).## Deploying the Function
```
# clone this repo
git clone [email protected]:digitalocean/sample-functions-python-jokes.git
``````
# deploy the project, using "remote-build" so that the build and runtime environments match
> doctl serverless deploy sample-functions-python-jokes --remote-build
Deploying 'sample-functions-python-jokes'
to namespace 'fn-...'
on host 'https://faas-...'
Submitted action 'joke' for remote building and deployment in runtime python:default
Processing of 'joke' is still running remotely ...
...
Deployed functions ('doctl sbx fn get --url' for URL):
- joke
``````
# execute the function
> doctl serverless functions invoke joke
{
"body": {
"response_type": "in_channel",
"text": "Waiter: He's choking! Is anyone a doctor? Programmer: I'm a Vim user."
}
}
```Note the CLI command can be abbreviated as `doctl sls fn invoke joke`.
### Learn More
You can learn more about Functions and App Platform integration in [the official App Platform Documentation](https://www.digitalocean.com/docs/app-platform/).