diff --git a/firebase.json b/firebase.json index 01f98cc..acb4a4f 100644 --- a/firebase.json +++ b/firebase.json @@ -13,10 +13,10 @@ "**/.*", "**/node_modules/**" ], - "rewrites": [ + "rewrites": [ { "source": "/api/v1/**", - "function": "wwww.webApi" + "function": "www-webApi" } ] } diff --git a/functions/package-lock.json b/functions/package-lock.json index 70c10b2..1365c31 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -754,7 +754,6 @@ "version": "7.0.2", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.2.tgz", "integrity": "sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==", - "dev": true, "requires": { "cross-spawn": "^7.0.1" } @@ -763,7 +762,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1715,8 +1713,7 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, "js-stringify": { "version": "1.0.2", @@ -2109,8 +2106,7 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { "version": "1.0.6", @@ -2488,7 +2484,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -2496,8 +2491,7 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "side-channel": { "version": "1.0.2", @@ -2803,7 +2797,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "requires": { "isexe": "^2.0.0" } diff --git a/functions/package.json b/functions/package.json index 5c04d26..da07624 100644 --- a/functions/package.json +++ b/functions/package.json @@ -7,7 +7,7 @@ "shell": "npm run build && firebase functions:shell", "start": "npm run shell", "deploy": "cross-env-shell RUN_SERVER=true RUN_DAEMON=true firebase deploy --only functions", - "deploy-server": "cross-env-shell RUN_SERVER=true firebase deploy --only functions:www", + "deploy-server": "cross-env-shell RUN_SERVER=true \"firebase deploy --only functions\"", "logs": "firebase functions:log", "server": "cross-env-shell RUN_SERVER=true \"npm run build && firebase emulators:start --only functions\"", "daemon": "cross-env-shell RUN_DAEMON=true \"npm run build && firebase emulators:start --only functions\"" diff --git a/functions/src/app.ts b/functions/src/app.ts index 45a8d7a..a0a1b7b 100644 --- a/functions/src/app.ts +++ b/functions/src/app.ts @@ -11,7 +11,7 @@ const app = express(); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'pug'); -app.use(logger('dev')); +app.use(logger('combined')); app.use(express.json()); app.use(express.urlencoded({extended: false})); app.use(express.static(path.join(__dirname, 'public'))); diff --git a/functions/src/bin/index.ts b/functions/src/bin/index.ts index e04036a..2f70335 100644 --- a/functions/src/bin/index.ts +++ b/functions/src/bin/index.ts @@ -1,5 +1,7 @@ -const runServer = process.env.RUN_SERVER; -const runDaemon = process.env.RUN_DAEMON; +import functions = require('firebase-functions'); + +const runServer = process.env.RUN_SERVER || functions.config().execution.run_server; +const runDaemon = process.env.RUN_DAEMON || functions.config().execution.run_daemon; if (runServer === undefined && runDaemon === undefined) { exports.www = require('./www'); diff --git a/functions/src/bin/www.ts b/functions/src/bin/www.ts index 24a8147..65cc5be 100644 --- a/functions/src/bin/www.ts +++ b/functions/src/bin/www.ts @@ -18,8 +18,7 @@ const server = http.createServer(app); */ server.on('error', onError); server.on('listening', onListening); -if (process.env.RUN_SERVER) - exports.webApi = functions.https.onRequest(app); +exports.webApi = functions.https.onRequest(app); /** * Normalize a port into a number, string or false diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..829eda8 --- /dev/null +++ b/public/404.html @@ -0,0 +1,33 @@ + + +
+ + +The specified file was not found on this website. Please check the URL for mistakes and try again.
+This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!
+ Open Hosting Documentation +Firebase SDK Loading…
+ + + +