[轉]Keep your promises when using Cloud Functions for Firebase!

https://firebase.googleblog.com/2017/06/keep-your-promises-when-using-cloud.html?fbclid=IwAR2FuvlU2CbwjV-I75q7-WIkJyLHRYT-R3cyleEUWF3Fsq42THMCwZN6by8 const ref_p1_state = root.child(`player_states/${game_state.p1uid}`) const ref_p2_state = root.child(`player_states/${game_state.p2uid}`) const pr_update_p1 = ref_p1_state.update(update_p1) const pr_update_p2 = ref_p2_state.update(update_p2) return Promise.all([pr_update_p1, pr_update_p2]) ========== https://stackoverflow.com/questions/55430079/promise-all-does-not-wait-for-firestore-query-to-loop

2020-03-10 · 1 min · 22 words · Me

nodexjs expressjs ajv apidoc converter generator restclient curl postman

ajv schema to apidoc schema https://github.com/willfarrell/apidoc-plugin-schema required can’t product doc. converter https://github.com/apidoc/apidoc#converter to swagger https://github.com/fsbahman/apidoc-swagger postman collection to apidoc https://github.com/bonzzy/docmaster RestClient -> curl -> postman

2020-03-07 · 1 min · 25 words · Me

promise.all error catch

https://stackoverflow.com/questions/30362733/handling-errors-in-promise-all Promise.all(state.routes.map(function(route) { return route.handler.promiseHandler().catch(function(err) { return err; }); })) .then(function(arrayOfValuesOrErrors) { // handling of my array containing values and/or errors. }) .catch(function(err) { console.log(err.message); // some coding error in handling happened }); Alternately, if you have a case where you don’t particularly care about the values of the resolved promises when there is one failure but you still want them to have run, you could do something like this which will resolve with the promises as normal when they all succeed and reject with the failed promises when any of them fail: ...

2020-03-05 · 1 min · 136 words · Me

firestore import

使用 https://github.com/dalenguyen/firestore-backup-restore base on https://github.com/dalenguyen/firestore-import-export 能處理timestamp

2020-03-04 · 1 min · 6 words · Me

filestore2json json2filestore

https://gist.github.com/sturmenta/cbbe898227cb1eaca7f85d0191eaec7e#gistcomment-2837988 ok can use. good job. timestamp have error.

2020-03-04 · 1 min · 9 words · Me