Search code examples
javascriptnode.jsfirebasegoogle-cloud-functionsfirebase-hosting

How to deploy a nodejs app with module.exports on Firebase


I am using node js and yarn for my slack bot. Its working fine locally, but I dont know how to deploy that on firebase to let my bot working. This is my index.js:

const functions = require('firebase-functions');
require = require("esm")(module/*, options */);
module.exports = require("./app.js");

but to deploy it on firebase I need something like that my index.js:

    const app = express();
    exports.widgets = functions.https.onRequest(app);

but I'm not using express(). So how should I do that? P.S. all my bot logic is in app.js, thats the reason why I require("./app.js");


Solution

  • You can deploy with Firebase Hosting: https://firebase.google.com/docs/hosting/deploying. It is pretty easy to use.