Skip to content

Commit 7ec4f20

Browse files
authored
docs: Restyle readme (#248)
1 parent 9362e7c commit 7ec4f20

File tree

1 file changed

+37
-64
lines changed

1 file changed

+37
-64
lines changed

README.md

Lines changed: 37 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ Replace `<VERSION>` with the version you want to install.
3535
## Configure Parse Server
3636

3737
```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+
3943
const parseServerOptions = {
4044
push: {
4145
adapter: new PushAdapter({
@@ -50,11 +54,11 @@ const parseServerOptions = {
5054
},
5155
expo: {
5256
// Expo push options
53-
},
54-
}),
55-
},
57+
}
58+
})
59+
}
5660
// Other Parse Server options
57-
}
61+
};
5862
```
5963

6064
### Apple Push Options
@@ -75,27 +79,19 @@ Example options:
7579
Both services (APNS, FCM) can be used in combination for different Apple ecosystems.
7680

7781
```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>'
9788
},
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'
9995
}
10096
```
10197

@@ -108,35 +104,20 @@ Delivering push notifications to Android devices can be done via Firebase Cloud
108104
Example options:
109105

110106
```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'
121109
}
122110
```
123111

124112
Alternatively, instead of setting `firebaseServiceAccount` to the path of the JSON file, you can provide an object representing a Google Cloud service account key:
125113

126114
```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+
}
140121
}
141122
```
142123

@@ -149,17 +130,9 @@ This can be helpful if you are already managing credentials to Google Cloud APIs
149130
Example options (deprecated):
150131

151132
```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>'
163136
}
164137
```
165138

@@ -169,8 +142,8 @@ Example options:
169142

170143
```js
171144
expo: {
172-
accessToken: '<EXPO_ACCESS_TOKEN>',
173-
},
145+
accessToken: '<EXPO_ACCESS_TOKEN>'
146+
}
174147
```
175148

176149
For more information see the [Expo docs](https://docs.expo.dev/push-notifications/overview/).
@@ -186,11 +159,11 @@ const parseServerOptions = {
186159
push: {
187160
ios: {
188161
// Apple push options
189-
},
162+
}
190163
// Other push options
191-
},
164+
}
192165
// Other Parse Server options
193-
}
166+
};
194167
```
195168

196169
## Logging

0 commit comments

Comments
 (0)