Browse Source

Changing quickstart sample to use 'req' and 'res' since that's best practice for ExpressJS.

Change-Id: I4fac6dba44c587f79aef8c737928301311d2e021
ryanpbrewster-patch-1
Nicolas Garnier 8 years ago
parent
commit
f65798897f
  1. 6
      quickstarts/uppercase/functions/index.js

6
quickstarts/uppercase/functions/index.js

@ -27,14 +27,14 @@ admin.initializeApp(functions.config().firebase);
// Take the text parameter passed to this HTTP endpoint and insert it into the
// Realtime Database under the path /messages/:pushId/original
// [START addMessageTrigger]
exports.addMessage = functions.https.onRequest((request, response) => {
exports.addMessage = functions.https.onRequest((req, res) => {
// [END addMessageTrigger]
// Grab the text parameter.
const original = request.query.text;
const original = req.query.text;
// Push it into the Realtime Database then send a response
admin.database().ref('/messages').push({original: original}).then(snapshot => {
// Redirect with 303 SEE OTHER to the URL of the pushed object in the Firebase console.
response.redirect(303, snapshot.ref);
res.redirect(303, snapshot.ref);
});
});
// [END addMessage]

Loading…
Cancel
Save