Skip to content

Commit

Permalink
Adds Firestore quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
abeisgoat committed Oct 3, 2017
1 parent 0fdcba7 commit 3d47aab
Show file tree
Hide file tree
Showing 19 changed files with 2,435 additions and 0 deletions.
24 changes: 24 additions & 0 deletions firestore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# FriendlyEats (Web)

## Introduction

Fire Eats is a restaurant recommendation app built on Cloud Firestore.
For more information about Firestore visit [the docs][firestore-docs].

[firestore-docs]: https://firebase.google.com/docs/firestore/

## Setup

Install the Firebase CLI:

```
npm -g i firebase-tools
```

Then run a local server:

```
firebase serve --project YOUR_PROJECT_ID
```

You will also need to enable Anonymous Authentication in your Firebase Console
5 changes: 5 additions & 0 deletions firestore/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
importScripts('/__/firebase/3.8.0/firebase-app.js');
importScripts('/__/firebase/3.8.0/firebase-messaging.js');
importScripts('/__/firebase/init.js');

firebase.messaging();
32 changes: 32 additions & 0 deletions firestore/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"hosting": {
"public": "./",
"ignore": [
"firebase.json",
"database-rules.json",
"storage.rules",
"functions"
],
"headers": [
{
"source": "**/*.@(js|html)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=0"
}
]
}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}
60 changes: 60 additions & 0 deletions firestore/firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"indexes": [
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "city", "mode": "ASCENDING" },
{ "fieldPath": "avgRating", "mode": "DESCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "category", "mode": "ASCENDING" },
{ "fieldPath": "avgRating", "mode": "DESCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "price", "mode": "ASCENDING" },
{ "fieldPath": "avgRating", "mode": "DESCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "city", "mode": "ASCENDING" },
{ "fieldPath": "numRatings", "mode": "DESCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "category", "mode": "ASCENDING" },
{ "fieldPath": "numRatings", "mode": "DESCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "price", "mode": "ASCENDING" },
{ "fieldPath": "numRatings", "mode": "DESCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "city", "mode": "ASCENDING" },
{ "fieldPath": "price", "mode": "ASCENDING" }
]
},
{
"collectionId": "restaurants",
"fields": [
{ "fieldPath": "category", "mode": "ASCENDING" },
{ "fieldPath": "price", "mode": "ASCENDING" }
]
}
]
}
7 changes: 7 additions & 0 deletions firestore/firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write if auth != null;
}
}
}
Binary file added firestore/images/favicon.ico
Binary file not shown.
Binary file added firestore/images/guy_fireats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firestore/images/icons/friendlyeats-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3d47aab

Please sign in to comment.