@@ -35,7 +35,11 @@ Replace `<VERSION>` with the version you want to install.
35
35
## Configure Parse Server
36
36
37
37
``` js
38
- const PushAdapter = require (' @parse/push-adapter' ).default ;
38
+ import { ParsePushAdapter } from ' @parse/push-adapter' ;
39
+
40
+ // For CommonJS replace the import statemtent above with the following line:
41
+ // const PushAdapter = require('@parse/push-adapter').default;
42
+
39
43
const parseServerOptions = {
40
44
push: {
41
45
adapter: new PushAdapter ({
@@ -50,11 +54,11 @@ const parseServerOptions = {
50
54
},
51
55
expo: {
52
56
// Expo push options
53
- },
54
- }),
55
- },
57
+ }
58
+ })
59
+ }
56
60
// Other Parse Server options
57
- }
61
+ };
58
62
```
59
63
60
64
### Apple Push Options
@@ -75,27 +79,19 @@ Example options:
75
79
Both services (APNS, FCM) can be used in combination for different Apple ecosystems.
76
80
77
81
``` js
78
- const PushAdapter = require (' @parse/push-adapter' ).default ;
79
- const parseServerOptions = {
80
- push: {
81
- adapter: new PushAdapter ({
82
- ios: {
83
- // Deliver push notifications to iOS devices via APNS
84
- token: {
85
- key: __dirname + ' /apns.p8' ,
86
- keyId: ' <APNS_KEY_ID>' ,
87
- teamId: ' <APNS_TEAM_ID>' ,
88
- },
89
- topic: ' <BUNDLE_IDENTIFIER>' ,
90
- production: true
91
- },
92
- osx: {
93
- // Deliver push notifications to macOS devices via FCM
94
- firebaseServiceAccount: __dirname + ' /firebase.json'
95
- },
96
- }),
82
+ ios: {
83
+ // Deliver push notifications to iOS devices via APNS
84
+ token: {
85
+ key: __dirname + ' /apns.p8' ,
86
+ keyId: ' <APNS_KEY_ID>' ,
87
+ teamId: ' <APNS_TEAM_ID>'
97
88
},
98
- // Other Parse Server options
89
+ topic: ' <BUNDLE_IDENTIFIER>' ,
90
+ production: true
91
+ },
92
+ osx: {
93
+ // Deliver push notifications to macOS devices via FCM
94
+ firebaseServiceAccount: __dirname + ' /firebase.json'
99
95
}
100
96
```
101
97
@@ -108,35 +104,20 @@ Delivering push notifications to Android devices can be done via Firebase Cloud
108
104
Example options:
109
105
110
106
``` js
111
- const PushAdapter = require (' @parse/push-adapter' ).default ;
112
- const parseServerOptions = {
113
- push: {
114
- adapter: new PushAdapter ({
115
- android: {
116
- firebaseServiceAccount: __dirname + ' /firebase.json'
117
- },
118
- }),
119
- },
120
- // Other Parse Server options
107
+ android: {
108
+ firebaseServiceAccount: __dirname + ' /firebase.json'
121
109
}
122
110
```
123
111
124
112
Alternatively, instead of setting ` firebaseServiceAccount ` to the path of the JSON file, you can provide an object representing a Google Cloud service account key:
125
113
126
114
``` js
127
- const parseServerOptions = {
128
- push: {
129
- adapter: new PushAdapter ({
130
- android: {
131
- firebaseServiceAccount: {
132
- projectId: ' <PROJECT_ID>' ,
133
- clientEmail: ' example@<PROJECT_ID>.iam.gserviceaccount.com' ,
134
- privateKey: ' -----BEGIN PRIVATE KEY-----<KEY>-----END PRIVATE KEY-----\n '
135
- },
136
- },
137
- }),
138
- },
139
- // Other Parse Server options
115
+ android: {
116
+ firebaseServiceAccount: {
117
+ projectId: ' <PROJECT_ID>' ,
118
+ clientEmail: ' example@<PROJECT_ID>.iam.gserviceaccount.com' ,
119
+ privateKey: ' -----BEGIN PRIVATE KEY-----<KEY>-----END PRIVATE KEY-----\n '
120
+ }
140
121
}
141
122
```
142
123
@@ -149,17 +130,9 @@ This can be helpful if you are already managing credentials to Google Cloud APIs
149
130
Example options (deprecated):
150
131
151
132
``` js
152
- const PushAdapter = require (' @parse/push-adapter' ).default ;
153
- const parseServerOptions = {
154
- push: {
155
- adapter: new PushAdapter ({
156
- android: {
157
- // Deliver push notifications via FCM legacy API (deprecated)
158
- apiKey: ' <API_KEY>'
159
- },
160
- }),
161
- },
162
- // Other Parse Server options
133
+ android: {
134
+ // Deliver push notifications via FCM legacy API (deprecated)
135
+ apiKey: ' <API_KEY>'
163
136
}
164
137
```
165
138
@@ -169,8 +142,8 @@ Example options:
169
142
170
143
``` js
171
144
expo: {
172
- accessToken: ' <EXPO_ACCESS_TOKEN>' ,
173
- },
145
+ accessToken: ' <EXPO_ACCESS_TOKEN>'
146
+ }
174
147
```
175
148
176
149
For more information see the [ Expo docs] ( https://docs.expo.dev/push-notifications/overview/ ) .
@@ -186,11 +159,11 @@ const parseServerOptions = {
186
159
push: {
187
160
ios: {
188
161
// Apple push options
189
- },
162
+ }
190
163
// Other push options
191
- },
164
+ }
192
165
// Other Parse Server options
193
- }
166
+ };
194
167
```
195
168
196
169
## Logging
0 commit comments