Enjoy this random emoji image: !
There are 4 key RESTful endpoints (check the Postman Collection for more details):
https://us-central1-gh-img.cloudfunctions.net/setImage
POST
Requires:
{
"url": "any valid image URL"
}
Returns:
{
"id": "5 digit alpha numeric string" // (don't lose this)
}
OR
HTTP 405
https://us-central1-gh-img.cloudfunctions.net/getImage
GET
Requires URL query: id={ID_HERE}
eg: https://us-central1-gh-img.cloudfunctions.net/getImage?id=abcd1
This is what you'll embed in your Username/README.md
Returns:
The image from the URL that was posted
OR
HTTP 405 (if incorrect method or missing query)
OR
HTTP 500 (if there is an issue with URL)
https://us-central1-gh-img.cloudfunctions.net/getStats
GET
Requires URL query: id={ID_HERE}
eg: https://us-central1-gh-img.cloudfunctions.net/getStats?id=abcd1
This is what you'll embed in your Username/README.md
Returns:
{
"count": 10 // The number of successful GET requests performed to getImage
}
OR
HTTP 405 (if incorrect method or missing query)
https://us-central1-gh-img.cloudfunctions.net/randomEmoji
OR
https://emoji.braedensmith.workers.dev (faster)
GET
Returns:
A random SVG emoji from https://github.com/twitter/twemoji
cd functions
npm install
npm install -g firebase
firebase login
npm run serve
firebase deploy