I'm working with firebase functions and it is very hard to mange it index.js
index.js
files like:
index.js
I want to be index.js
and sub domain routing in apitest.js
with express.js
index.js
apis -> test.js
index.js
const express = require('express');
const functions = require('firebase-functions');
const app = express();
...
const funcTestApi = require('./apis/apitest');
exports.apitest = functions.https.onRequest(app => {
funcTestApi.router(app);
});
apitest.js
exports.router = function(app) {
app.get('/foo', (req, res) => {
res.status(200).json('hello');
});
app.get('/bar', (req, res) => {
res.status(200).json('world');
});
... // other url route
}
Log:
http http://localhost:5000/project-name/us-central1/apitest/foo
http http://localhost:5000/project-name/us-central1/apitest/bar
...
info: Execution took 60000 ms, finished with status: 'timeout'
It's not working.