Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ethan-arrowood/twitch-azure-function-example
https://github.com/ethan-arrowood/twitch-azure-function-example
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ethan-arrowood/twitch-azure-function-example
- Owner: Ethan-Arrowood
- Created: 2021-11-04T20:59:32.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-30T15:55:57.000Z (about 3 years ago)
- Last Synced: 2024-10-05T17:43:19.534Z (3 months ago)
- Language: TypeScript
- Size: 67.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twitch Azure Function Example
This repo contains a Node.js/TypeScript Azure Function example that utilizes the Twitch API. The Function is a HTTP Trigger that returns a random live stream based on a given game. You can specify a game using the `game` query parameter (defaults to `"minecraft"`).
In order to run this Function you need to specify two application settings (a.k.a. environment variables). You can find these values on your Twitch Developer page.
```sh
TWITCH_CLIENT_ID
TWITCH_CLIENT_SECRET
```When developing locally, define a `local.settings.json` file in the root of the function app
```json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "node",
"TWITCH_CLIENT_ID": "",
"TWITCH_CLIENT_SECRET": ""
}
}
```## Examples
> Response data has been replaced with fake values
### Default
URL: `https://etarrowo-az-func-upskilling.azurewebsites.net/api/getvideostream`
Response:
```json
{
"id": "111",
"user_id": "001",
"user_login": "steve",
"user_name": "steve",
"game_id": "27471",
"game_name": "Minecraft",
"type": "live",
"title": "Minecraft Survival",
"viewer_count": 1000,
"started_at": "",
"language": "en",
"thumbnail_url": "",
"tag_ids": [],
"is_mature": false
}
```### Game Specified
URL: `https://etarrowo-az-func-upskilling.azurewebsites.net/api/getvideostream?game=league%20of%20legends`
```json
{
"id": "222",
"user_id": "002",
"user_login": "ashe",
"user_name": "Ashe",
"game_id": "21779",
"game_name": "League of Legends",
"type": "live",
"title": "Summoner's Rift",
"viewer_count": 1000,
"started_at": "",
"language": "en",
"thumbnail_url": "",
"tag_ids": [],
"is_mature": false
}
```