forked from safak/react-firebase-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitignore
More file actions
127 lines (99 loc) Β· 3.18 KB
/
Copy path.gitignore
File metadata and controls
127 lines (99 loc) Β· 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# import { getFirestore } from "firebase/firestore";
# const db = getFirestore(app);
# ``` |
# ```js
# import { getFirestore, connectFirestoreEmulator } from "firebase/firestore";
# const db = getFirestore(app);
# connectFirestoreEmulator(db, "localhost", 8085);
# ``` |
# ---
# ### π Authentication
# | Feature | **Live Firebase** | **Using Emulator** |
# |--------|------------------|------------------|
# | **Import & Init** | `getAuth(app)` | `getAuth(app)` |
# | **Connect** | _(none needed)_ | `connectAuthEmulator(auth, "http://localhost:9100");` |
# | **Full Example** |
# ```js
# import { getAuth } from "firebase/auth";
# const auth = getAuth(app);
# ``` |
# ```js
# import { getAuth, connectAuthEmulator } from "firebase/auth";
# const auth = getAuth(app);
# connectAuthEmulator(auth, "http://localhost:9100");
# ``` |
# ---
# ### π Storage
# | Feature | **Live Firebase** | **Using Emulator** |
# |--------|------------------|------------------|
# | **Import & Init** | `getStorage(app)` | `getStorage(app)` |
# | **Connect** | _(none needed)_ | `connectStorageEmulator(storage, "localhost", 9200);` |
# | **Full Example** |
# ```js
# import { getStorage } from "firebase/storage";
# const storage = getStorage(app);
# ``` |
# ```js
# import { getStorage, connectStorageEmulator } from "firebase/storage";
# const storage = getStorage(app);
# connectStorageEmulator(storage, "localhost", 9200);
# ``` |
# ---
# ### π Realtime Database (if used)
# | Feature | **Live Firebase** | **Using Emulator** |
# |--------|------------------|------------------|
# | **Import & Init** | `getDatabase(app)` | `getDatabase(app)` |
# | **Connect** | _(none needed)_ | `connectDatabaseEmulator(database, "localhost", 9005);` |
# | **Full Example** |
# ```js
# import { getDatabase } from "firebase/database";
# const database = getDatabase(app);
# ``` |
# ```js
# import { getDatabase, connectDatabaseEmulator } from "firebase/database";
# const database = getDatabase(app);
# connectDatabaseEmulator(database, "localhost", 9005);
# ``` |
# ---
# ### π Hosting
# | Feature | **Live Firebase** | **Using Emulator** |
# |--------|------------------|------------------|
# | **Access** | `https://your-project.web.app` | `http://localhost:5005` |
# | **Deploy** | `firebase deploy --only hosting` | `firebase emulators:start` |
# | **Notes** | Hosting on the web | Local server for testing |
# ---
# ### β
Best Practice Wrapper (Automatic Emulator Detection)
# To auto-use emulators **only in dev**, wrap it like this:
# ```js
# if (location.hostname === "localhost") {
# connectAuthEmulator(auth, "http://localhost:9100");
# connectFirestoreEmulator(db, "localhost", 8085);
# connectStorageEmulator(storage, "localhost", 9200);
# connectDatabaseEmulator(database, "localhost", 9005);
# }
# Feature Live Firebase Using Emulator
# Import & Init getFirestore(app) getFirestore(app)
# Connect (none needed) connectFirestoreEmulator(db, "localhost", 8085);
# Full Example