Skip to content

Instantly share code, notes, and snippets.

@darkedges
Last active December 10, 2016 22:11
Show Gist options
  • Select an option

  • Save darkedges/2ec023067cd23e5a028a4afdcff093b0 to your computer and use it in GitHub Desktop.

Select an option

Save darkedges/2ec023067cd23e5a028a4afdcff093b0 to your computer and use it in GitHub Desktop.
curl -X POST http://localhost:8008/helloWorldHttp -H "Content-Type: application/json" -d "{\"name\": \"Test\"}"
/**
* HTTP Cloud Function.
*
* @param {Object} req Cloud Function request context.
* @param {Object} res Cloud Function response context.
*/
exports.helloWorldHttp = function helloWorldHttp (req, res) {
res.send('Hello ${req.body.name || 'World'}!');
};
Starting Google Cloud Functions Emulator...
Google Cloud Functions Emulator STARTED
┌───────────────┬────────────┬────────────────────────────────────────────────────┐
│ Name │ Type │ Path │
├───────────────┴────────────┴────────────────────────────────────────────────────┤
│ No functions deployed _\_(?)_/_. Run "functions deploy" to deploy a function │
└─────────────────────────────────────────────────────────────────────────────────┘
Function helloWorldHttp deployed.
┌──────────┬──────────────────────────────────────────────────────────────────────┐
│ Property │ Value │
├──────────┼──────────────────────────────────────────────────────────────────────┤
│ Name │ helloWorldHttp │
├──────────┼──────────────────────────────────────────────────────────────────────┤
│ Type │ HTTP │
├──────────┼──────────────────────────────────────────────────────────────────────┤
│ Path │ C:\development\gcloud\functions │
├──────────┼──────────────────────────────────────────────────────────────────────┤
│ Url │ http://localhost:8008/helloWorldHttp │
└──────────┴──────────────────────────────────────────────────────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment