Skip to content

Instantly share code, notes, and snippets.

@rilian
Last active May 22, 2019 20:58
Show Gist options
  • Save rilian/dbc3ed86cf6b1365e1bdd4c2db469048 to your computer and use it in GitHub Desktop.
Save rilian/dbc3ed86cf6b1365e1bdd4c2db469048 to your computer and use it in GitHub Desktop.
functions example for SO comment.
I currently use https://us-central1-project-name.cloudfunctions.net/users/123 in production
and want to switch to using https://example.com/users/123
Is there any way to workaround, or do you have any suggestions
to keep old URLs at *.cloudfunctions.net working for backwards compatibility ?
Otherwise default URL gets changed to https://us-central1-project-name.cloudfunctions.net/users/users/123 ...
const functions = require("firebase-functions");
exports['users'] = functions.https.onRequest(require('users.js));
const app = require("express")();
app.get("/users/:id", (req, res) => {
// return user json by id
}
const app = require("express")();
app.get("/:id", (req, res) => {
// return user json by id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment