Skip to content

Instantly share code, notes, and snippets.

@evilUrge
Last active May 13, 2019 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilUrge/8953f23ead66358c21290c3c471fb410 to your computer and use it in GitHub Desktop.
Save evilUrge/8953f23ead66358c21290c3c471fb410 to your computer and use it in GitHub Desktop.
Firebase function serving restify server if production(else just start server onj)
const server = require(`./src/server`);
process.env.NODE_ENV === "DEV" ?
/**
* If dev environment, run express server for local debugging.
*/
server.listen(process.env.PORT || 3000) :
/**
* Creates a function instance and with a specific specs.
* Serve to FireBase Express server obj.
*/
exports[require("./package").name] = require("firebase-functions")
.region("europe-west1")
.runWith({ timeoutSeconds: 300, memory: "2GB" }).https.onRequest(server);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment