-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
29 lines (29 loc) · 943 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
const pubsub = require("@google-cloud/pubsub")({
keyFilename: "/path/to/keyfile.json",
projectId: "grape-spaceship-123"})
console.log(pubsub)
*/
const settings = require("./settings.json");
console.log(settings);
function helloWorldHTTP(req, res) {
console.log(req);
res
.status(200)
.type("application/json")
.send("{ \"result\": \"Hello World!\"}")
.end();
}
exports.helloWorldHTTP = helloWorldHTTP;
function helloWorldPubSub(event, callback) {
console.log("Hello World! I have got event from Google Cloud Pub/Sub topic: ", event.data);
callback();
}
exports.helloWorldPubSub = helloWorldPubSub;
function helloWorldStorage(event, callback) {
console.log("Hello World! I have got event from Google Cloud Storage bucket: ", event.data);
callback();
}
exports.helloWorldStorage = helloWorldStorage;