Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonprickett/google-cloud-functions-go
Experiment with Google Cloud Functions for the Go language.
https://github.com/simonprickett/google-cloud-functions-go
cloudfunctions golang google-cloud randomuser-api serverless
Last synced: about 1 month ago
JSON representation
Experiment with Google Cloud Functions for the Go language.
- Host: GitHub
- URL: https://github.com/simonprickett/google-cloud-functions-go
- Owner: simonprickett
- License: mit
- Created: 2019-01-19T01:18:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T02:12:23.000Z (almost 6 years ago)
- Last Synced: 2024-10-29T15:49:32.651Z (3 months ago)
- Topics: cloudfunctions, golang, google-cloud, randomuser-api, serverless
- Language: Go
- Homepage: https://simonprickett.dev/
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Google Cloud Functions Go Runtime Demo
Demo Google Cloud Function showing use of the Go runtime. Read the Medium article that explains this [here](https://medium.com/@simon_prickett/writing-google-cloud-functions-in-go-fb711f33459a).
## Deployment
```
$ gcloud components update
$ gcloud components install beta
$ gcloud beta functions deploy getUserDetails --runtime go111 --entry-point GetUserDetails --trigger-http --project
```Where `` is your Google Cloud project ID.
## Testing
Point a browser at:
```
https://-.cloudfunctions.net/getUserDetails
```Where:
* `` is the Google Cloud region that you deployed to (e.g. `us-central1`)
* `` is your Google Cloud project ID(the full URL that you need will be displayed in the output of the `gcloud` command when deploying the function).
You should see JSON representing a random user object pulled from the API that looks something like:
```
{
"cell": "0911-857-4769",
"dob": {
"age": 64,
"date": "1954-01-11T01:37:49Z"
},
"email": "محمدامين.پارسا@example.com",
"gender": "male",
"generator": "google-cloud-function",
"id": {
"name": "",
"value": null
},
"location": {
"city": "ایلام",
"coordinates": {
"latitude": "32.1895",
"longitude": "-138.2377"
},
"postcode": 41995,
"state": "کرمانشاه",
"street": "206 دکتر مفتح",
"timezone": {
"description": "Ekaterinburg, Islamabad, Karachi, Tashkent",
"offset": "+5:00"
}
},
"login": {
"md5": "c83471713279d94cb2a33a4b03a456cd",
"password": "lacrosse",
"salt": "B9vhBXeE",
"sha1": "09ff43c271437499467aab431df1bc522e1574a9",
"sha256": "f39c50bf339b6dd973e3dfdea0ddee451fc90cc5adb7580c8f386a2c9f2ff304",
"username": "orangeelephant750",
"uuid": "bcb042d5-7f52-47c1-b883-b296268bec07"
},
"name": {
"first": "محمدامين",
"last": "پارسا"",
"title": "mr"
},
"nat": "IR",
"phone": "014-57870431",
"picture": {
"large": "https://randomuser.me/api/portraits/men/40.jpg",
"medium": "https://randomuser.me/api/portraits/med/men/40.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/men/40.jpg"
},
"registered": {
"age": 6,
"date": "2011-10-26T06:05:55Z"
}
}
```