Microsoft's 25 Days of Serverless Challenge but with Google Cloud Functions
API Documentation https://us-central1-fsuptutorial.cloudfunctions.net/api/api-docs/
- ⭐️Wk 1 : Challenge 1 : Spin up a Serverless Dreidel
- ⭐️Wk 1 : Challenge 2 : Lucy's Dilemma
- ⭐️Wk 1 : Challenge 3 : Secret Santa's Gifts
- ⭐️Wk 1 : Challenge 4 : Ezra's Potluck
- ⭐️Wk 1 : Challenge 5 : Naughty or Nice
- ⭐️Wk 1 : Challenge 6 : Durable Pattern
- ⭐️Wk 1 : Challenge 7 : API Endpoint - Picture Challenge
- ⭐️Wk 2 : Challenge 8 : Build an Incident Status Page
- ⭐️Wk 2 : Challenge 9 : Automate Your GitHub Issues with Holiday Magic
- ⭐️Wk 2 : Challenge 10 : Timer Trigger
- ⭐️Wk 2 : Challenge 11 : Database Trigger
Location | Endpoint |
---|---|
Root path | https://us-central1-fsuptutorial.cloudfunctions.net/api/ |
Method | Endpoint | Description | Examples |
---|---|---|---|
GET |
/one |
Get the random letter. | one |
{
"letter": "ש"
}
Prerequisites
- PushBullet API KEY (To send push messages)
- Firebase Blaze Plan (To use Google Cloud Pub/Sub)
Prerequisites
- Firebase Blaze Plan
API EndPoints are secured with Firebase Authentication.
Location | Endpoint |
---|---|
Root path | https://us-central1-fsuptutorial.cloudfunctions.net/api/four |
Method | Endpoint | Access | Description | Examples |
---|---|---|---|---|
POST |
/register |
Public | Register the user in the database. | https://us-central1-fsuptutorial.cloudfunctions.net/api/four/register |
POST |
/login |
Public | User login. | https://us-central1-fsuptutorial.cloudfunctions.net/api/four/login |
POST |
/add |
Private | Create food items in the database. | https://us-central1-fsuptutorial.cloudfunctions.net/api/four/add |
GET |
/list |
Private | List the food items in the database. | https://us-central1-fsuptutorial.cloudfunctions.net/api/four/list |
PATCH |
/change |
Private | Update the food items in the database. | https://us-central1-fsuptutorial.cloudfunctions.net/api/four/change |
DELETE |
/remove |
Private | Delete the food items from the database. | https://us-central1-fsuptutorial.cloudfunctions.net/api/four/remove |
Database
Register
Send a POST request:
Request Body Payload
{
"email": "EMAIL",
"password": "PASSWORD",
"returnSecureToken": true
}
Response Payload
{
"idToken": "ID_TOKEN",
"email": "EMAIL",
"refreshToken": "REFRESH_TOKEN",
"expiresIn": "EXPIRES_IN_TIME",
"localId": "LOCAL_ID"
}
Login
Send a POST request:
Request Body Payload
{
"email": "EMAIL",
"password": "PASSWORD",
"returnSecureToken": true
}
Response Payload
{
"idToken": "ID_TOKEN",
"email": "EMAIL",
"refreshToken": "REFRESH_TOKEN",
"expiresIn": "EXPIRES_IN_TIME",
"localId": "LOCAL_ID",
"registered": true
}
Create a Food Item
Send a POST request:
Request Header
Authorization: Bearer ID_TOKEN
Request Body Payload
{
"dish_name": "DISH_NAME",
"type": "TYPE",
"amount": "AMOUNT"
}
Response Payload
{
"message": "successfully added",
"documentID": "DOCUMENT_ID"
}
List Food Items
Send a GET request:
Request Header
Authorization: Bearer ID_TOKEN
Response Payload
{
"food_item_count": 1,
"data": [
{
"email": "w.nipuna@gmail.com",
"amount": "2 Kg",
"type": "Dessert",
"uid": "Ua6FZqUXaNNEtLnSfLjmKVIoeaR2",
"dish_name": "Kokis"
}
]
}
Update a Food Item
Send a PATCH request:
Request Header
Authorization: Bearer ID_TOKEN
Request Body Payload
{
"dish_name": "DISH_NAME",
"type": "TYPE",
"amount": "AMOUNT",
"document_id": "DOCUMENT_ID"
}
Response Payload
{
"message": "Update successful"
}
Delete a Food Item
Send a DELETE request:
Request Header
Authorization: Bearer ID_TOKEN
Request Body Payload
{
"document_id": "DOCUMENT_ID"
}
Response Payload
{
"message": "Remove successful"
}
Uses Cloud Natural Language API and Cloud Translation API
Prerequisites
- Google Billing Account
Request Body Payload
{
"who": "Adam",
"message": "my little brother is so annoying and stupid"
}
Response Payload
{
"who": "Adam",
"message": "my little brother is so annoying and stupid",
"translation": "my little brother is so annoying and stupid",
"detected_language": "en",
"sentiment_magnitude": 0.800000011920929,
"sentiment_score": -0.800000011920929,
"naughty_or_nice": "Naughty"
}
Request Body Payload
{
"who": "Adam",
"message": "I really like the bike I got for a present"
}
Response Payload
{
"who": "Adam",
"message": "I really like the bike I got for a present",
"translation": "I really like the bike I got for a present",
"detected_language": "en",
"sentiment_magnitude": 0.6000000238418579,
"sentiment_score": 0.6000000238418579,
"naughty_or_nice": "Nice"
}
Request Body Payload
{
"who": "Eva",
"message": "Eu odeio limpar meu quarto"
}
Response Payload
{
"who": "Eva",
"message": "Eu odeio limpar meu quarto",
"translation": "I hate cleaning my room",
"detected_language": "pt",
"sentiment_magnitude": 0.6000000238418579,
"sentiment_score": -0.6000000238418579,
"naughty_or_nice": "Naughty"
}
Request Body Payload
{
"who": "tracy",
"message": "爸爸和圣诞老人很相似"
}
Response Payload
{
"who": "tracy",
"message": "爸爸和圣诞老人很相似",
"translation": "Dad and Santa are very similar",
"detected_language": "zh-CN",
"sentiment_magnitude": 0.10000000149011612,
"sentiment_score": 0.10000000149011612,
"naughty_or_nice": "Nice"
}
Uses Cloud Scheduler API
Prerequisites
- Google Billing Account
- Slack Workspace
Uses UNSPLASH Picture API with unsplash-js
Prerequisites
- Google Billing Account
- UNSPLASH Account
Request Body Payload
{
"query": "gifts"
}
Response Payload
{
"imageURLs": [
"https://images.unsplash.com/photo-1511885912508-36118d773e55?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1544654187-454deb2b423e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1511895307821-692dc4ad27c5?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1448832945950-bc85f82891bd?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1528029320621-f02197f47774?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1461092678334-1aa3ab3543ce?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1546813647-30583402ddd7?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1544362724-a403d8211f89?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1511953669874-6c617b315332?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0",
"https://images.unsplash.com/photo-1573853019548-c38efdbc2f09?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjEwNjI0Mn0"
]
}
Uses ReactJS, Google Cloud Firestore for Client UI (with realtime data updates) and Google Firebase Functions (Uses Firebase Auth for API PATCH requests)
Update Delivery System Status
Send a PATCH request:
Request Header
Authorization: Bearer ID_TOKEN
Request Body Payload
{
"status": "STATUS"
}
Response Payload
{
"message": "Update successful"
}
Update ReinDeer Guidance System Status
Send a PATCH request:
Request Header
Authorization: Bearer ID_TOKEN
Request Body Payload
{
"status": "STATUS"
}
Response Payload
{
"message": "Update successful"
}
Client UI
Uses octokit/rest.js
and Google Cloud Functions for Firebase
Still waiting for Twitter to review my Twitter developer account application.
Uses Google Cloud Firestore and Algolia for full text search support
Send a request
POST /add
Request Body Payload
{
"description": "I want a Tesla",
"name": "Nipuna Weerasekara",
"address": "Bad Route Rd, Terry, Mt 59349",
"type": "Car"
}
Response Payload
{
"message": "successfully added",
"documentID": "DOCUMENT_ID"
}
Get all requests by Santa
GET /list
Response Payload
{
"requests_count": 2,
"data": [
{
"description": "I want a Tesla",
"name": "Nipuna Weerasekara",
"address": "Bad Route Rd, Terry, Mt 59349",
"type": "Car"
},
{
"description": "I want a Baby Yoda action figure",
"name": "The Mandalorian",
"address": "234, Millennium Falcon",
"type": "Toy"
}
]
}
Query a specific request by a keyword
GET /find/:query | /find/car
Response Payload
{
"hits_count": 1,
"data": [
{
"description": "I want a Tesla",
"name": "Nipuna Weerasekara",
"address": "Bad Route Rd, Terry, Mt 59349",
"type": "Car"
}
]
}