NodeJS Hadith APIs
First of all you should have to install the Firebase CLI
npm install -g firebase-tools
Clone repository
git clone https://github.com/octabytes/hadith-api.git
Install require packages
npm install
Move into firebase dir
cd hadith-api/firebase
Run local Firestore
firebase emulators:start --only firestore --import=./cache
Your emulators start running on http://localhost:4000/firestore
Run API
export FIRESTORE_EMULATOR_HOST="localhost:8080"
npm start
or watch npm run watch
Open in browser
http://localhost:5000/v1/welcome
http://localhost:5000/v1/:collection/:id
http://localhost:5000/v1/books/:collection
http://localhost:5000/v1/:collection/book/:book_number
http://localhost:5000/v1/:collection/book/:book_number?offset=:number
http://localhost:5000/v1/:collection/book/:book_number?limit=:number
gsutil -m cp -r ./cache gs://islamicnet.appspot.com
{
"serve": "yarn build && firebase emulators:start --only functions,firestore --import=./firestore_export",
"db:update-local-from-remote": "yarn db:backup-remote && gsutil -m cp -r gs://my-firebase-bucket.appspot.com/firestore_export .",
"db:update-remote-from-local": "yarn db:backup-local && yarn db:backup-remote && gsutil -m cp -r ./firestore_export gs://my-firebase-bucket.appspot.com && yarn run db:import-remote",
"db:import-remote": "gcloud firestore import gs://my-firebase-bucket.appspot.com/firestore_export",
"db:backup-local": "firebase emulators:export --force .",
"db:rename-remote-backup-folder": "gsutil mv gs://my-firebase-bucket.appspot.com/firestore_export gs://my-firebase-bucket.appspot.com/firestore_export_$(date +%d-%m-%Y-%H-%M)",
"db:backup-remote": "yarn db:rename-remote-backup-folder && gcloud firestore export gs://my-firebase-bucket.appspot.com/firestore_export"
}