I am building a web site using ExpressJS + EJS for rendering server side content on Firebase Cloud Functions. At the index.js, located right under the functions folder, I have setup my express app with routes, middlewares, EJS views, and finally exported the express app variable via functions.https.onRequest so that all requests coming from firebase hosting could be rewritten to the ExpressJS app.
The challange here starts when one of the client pages (rendered at the server side) needs to invoke a callable function on the same functions project. How to serve callable functions and expressjs endpoints on the same project?
Putting all the code in the index.js might be a way to solve the issue, however, it will quickly become insane to manage all callable functions endpoints along with express endpoints in the same index.js file.
I have also seen that FCF now supports working with different codebases, but there isn't much information or any example in the documentation to follow along.
What would be your solution?