@vizmo/parse-server 8.6.2-3 → 9.10.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +265 -91
- package/lib/AccountLockout.js +14 -42
- package/lib/Adapters/Auth/BaseCodeAuthAdapter.js +24 -4
- package/lib/Adapters/Auth/apple.js +6 -4
- package/lib/Adapters/Auth/facebook.js +12 -9
- package/lib/Adapters/Auth/google.js +35 -93
- package/lib/Adapters/Auth/index.js +19 -2
- package/lib/Adapters/Auth/keycloak.js +56 -36
- package/lib/Adapters/Auth/ldap.js +30 -4
- package/lib/Adapters/Auth/mfa.js +42 -50
- package/lib/Adapters/Auth/oauth2.js +4 -4
- package/lib/Adapters/Cache/RedisCacheAdapter.js +2 -2
- package/lib/Adapters/Files/FilesAdapter.js +12 -2
- package/lib/Adapters/Files/GridFSBucketAdapter.js +53 -4
- package/lib/Adapters/PubSub/RedisPubSub.js +1 -3
- package/lib/Adapters/Push/PushAdapter.js +2 -2
- package/lib/Adapters/Storage/Mongo/MongoCollection.js +54 -4
- package/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js +169 -46
- package/lib/Adapters/Storage/Mongo/MongoTransform.js +30 -30
- package/lib/Adapters/Storage/Postgres/PostgresStorageAdapter.js +134 -36
- package/lib/Adapters/Storage/StorageAdapter.js +1 -1
- package/lib/Auth.js +82 -19
- package/lib/AuthDataLock.js +53 -0
- package/lib/Config.js +177 -22
- package/lib/Controllers/AdaptableController.js +6 -1
- package/lib/Controllers/DatabaseController.js +265 -40
- package/lib/Controllers/FilesController.js +26 -8
- package/lib/Controllers/LiveQueryController.js +2 -2
- package/lib/Controllers/ParseGraphQLController.js +3 -2
- package/lib/Controllers/PushController.js +2 -2
- package/lib/Controllers/SchemaController.js +3 -7
- package/lib/Controllers/UserController.js +12 -3
- package/lib/Deprecator/Deprecations.js +81 -7
- package/lib/Deprecator/Deprecator.js +15 -2
- package/lib/Error.js +5 -3
- package/lib/FileUrlValidator.js +69 -0
- package/lib/GraphQL/ParseGraphQLServer.js +156 -33
- package/lib/GraphQL/helpers/objectsMutations.js +3 -3
- package/lib/GraphQL/helpers/objectsQueries.js +4 -4
- package/lib/GraphQL/helpers/queryComplexity.js +138 -0
- package/lib/GraphQL/loaders/defaultGraphQLTypes.js +6 -5
- package/lib/GraphQL/loaders/functionsMutations.js +3 -4
- package/lib/GraphQL/loaders/parseClassMutations.js +4 -5
- package/lib/GraphQL/loaders/parseClassQueries.js +3 -4
- package/lib/GraphQL/loaders/schemaMutations.js +4 -5
- package/lib/GraphQL/loaders/schemaQueries.js +2 -3
- package/lib/GraphQL/loaders/usersMutations.js +5 -5
- package/lib/GraphQL/loaders/usersQueries.js +2 -2
- package/lib/GraphQL/parseGraphQLUtils.js +9 -1
- package/lib/GraphQL/transformers/mutation.js +7 -1
- package/lib/GraphQL/transformers/query.js +2 -2
- package/lib/InstallationDedup.js +178 -0
- package/lib/LiveQuery/ParseLiveQueryServer.js +574 -115
- package/lib/LiveQuery/ParseWebSocketServer.js +41 -5
- package/lib/LiveQuery/QueryTools.js +83 -22
- package/lib/LiveQuery/Subscription.js +6 -2
- package/lib/Options/Definitions.js +265 -36
- package/lib/Options/docs.js +77 -20
- package/lib/Options/index.js +1 -1
- package/lib/Options/parsers.js +8 -1
- package/lib/ParseServer.js +42 -20
- package/lib/ParseServerRESTController.js +14 -6
- package/lib/Push/PushWorker.js +2 -4
- package/lib/Push/utils.js +3 -4
- package/lib/RestQuery.js +205 -21
- package/lib/RestWrite.js +219 -116
- package/lib/Routers/AggregateRouter.js +33 -6
- package/lib/Routers/AudiencesRouter.js +2 -2
- package/lib/Routers/ClassesRouter.js +10 -6
- package/lib/Routers/FilesRouter.js +572 -57
- package/lib/Routers/FunctionsRouter.js +204 -16
- package/lib/Routers/HooksRouter.js +8 -1
- package/lib/Routers/IAPValidationRouter.js +2 -2
- package/lib/Routers/InstallationsRouter.js +2 -2
- package/lib/Routers/PagesRouter.js +57 -28
- package/lib/Routers/SessionsRouter.js +59 -25
- package/lib/Routers/UsersRouter.js +161 -47
- package/lib/SchemaMigrations/DefinedSchemas.js +2 -3
- package/lib/SchemaMigrations/Migrations.js +1 -1
- package/lib/Security/Check.js +2 -2
- package/lib/Security/CheckGroups/CheckGroupServerConfig.js +65 -1
- package/lib/SharedRest.js +7 -2
- package/lib/StatusHandler.js +3 -2
- package/lib/Utils.js +143 -17
- package/lib/batch.js +68 -2
- package/lib/cloud-code/Parse.Cloud.js +60 -11
- package/lib/defaults.js +12 -4
- package/lib/middlewares.js +234 -71
- package/lib/password.js +8 -2
- package/lib/rest.js +16 -14
- package/lib/triggers.js +54 -14
- package/package.json +57 -59
- package/public/custom_json.html +17 -0
- package/public/custom_json.json +23 -0
- package/public/custom_page.html +15 -0
- package/public/de/email_verification_link_expired.html +24 -0
- package/public/de/email_verification_link_invalid.html +21 -0
- package/public/de/email_verification_send_fail.html +21 -0
- package/public/de/email_verification_send_success.html +19 -0
- package/public/de/email_verification_success.html +18 -0
- package/public/de/password_reset.html +65 -0
- package/public/de/password_reset_link_invalid.html +19 -0
- package/public/de/password_reset_success.html +18 -0
- package/public/de-AT/email_verification_link_expired.html +24 -0
- package/public/de-AT/email_verification_link_invalid.html +21 -0
- package/public/de-AT/email_verification_send_fail.html +21 -0
- package/public/de-AT/email_verification_send_success.html +19 -0
- package/public/de-AT/email_verification_success.html +18 -0
- package/public/de-AT/password_reset.html +65 -0
- package/public/de-AT/password_reset_link_invalid.html +19 -0
- package/public/de-AT/password_reset_success.html +18 -0
- package/public/email_verification_link_expired.html +24 -0
- package/public/email_verification_link_invalid.html +21 -0
- package/public/email_verification_send_fail.html +21 -0
- package/public/email_verification_send_success.html +19 -0
- package/public/email_verification_success.html +18 -0
- package/public/password_reset.html +65 -0
- package/public/password_reset_link_invalid.html +19 -0
- package/public/password_reset_success.html +18 -0
- package/types/LiveQuery/ParseLiveQueryServer.d.ts +22 -2
- package/types/Options/index.d.ts +45 -5
- package/public_html/invalid_link.html +0 -45
- package/public_html/invalid_verification_link.html +0 -68
- package/public_html/link_send_fail.html +0 -45
- package/public_html/link_send_success.html +0 -45
- package/public_html/password_reset_success.html +0 -27
- package/public_html/verify_email_success.html +0 -27
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
[](https://app.codecov.io/github/parse-community/parse-server/tree/alpha)
|
|
9
9
|
[](https://github.com/parse-community/parse-dashboard/releases)
|
|
10
10
|
|
|
11
|
-
[](https://nodejs.org)
|
|
12
|
+
[](https://www.mongodb.com)
|
|
13
|
+
[](https://www.postgresql.org)
|
|
14
14
|
|
|
15
15
|
[](https://www.npmjs.com/package/parse-server)
|
|
16
16
|
[](https://www.npmjs.com/package/parse-server)
|
|
@@ -29,7 +29,7 @@ The full documentation for Parse Server is available in the [wiki](https://githu
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
A big
|
|
32
|
+
A big _thank you_ 🙏 to our [sponsors](#sponsors) and [backers](#backers) who support the development of Parse Platform!
|
|
33
33
|
|
|
34
34
|
#### Bronze Sponsors
|
|
35
35
|
|
|
@@ -58,6 +58,8 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
|
|
|
58
58
|
- [Basic Options](#basic-options)
|
|
59
59
|
- [Client Key Options](#client-key-options)
|
|
60
60
|
- [Access Scopes](#access-scopes)
|
|
61
|
+
- [Route Allow List](#route-allow-list)
|
|
62
|
+
- [Covered Routes](#covered-routes)
|
|
61
63
|
- [Email Verification and Password Reset](#email-verification-and-password-reset)
|
|
62
64
|
- [Password and Account Policy](#password-and-account-policy)
|
|
63
65
|
- [Custom Routes](#custom-routes)
|
|
@@ -68,7 +70,14 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
|
|
|
68
70
|
- [Using Environment Variables](#using-environment-variables)
|
|
69
71
|
- [Available Adapters](#available-adapters)
|
|
70
72
|
- [Configuring File Adapters](#configuring-file-adapters)
|
|
73
|
+
- [Restricting File URL Domains](#restricting-file-url-domains)
|
|
71
74
|
- [Idempotency Enforcement](#idempotency-enforcement)
|
|
75
|
+
- [Installations](#installations)
|
|
76
|
+
- [Options](#options)
|
|
77
|
+
- [`duplicateDeviceTokenActionEnforceAuth`](#duplicatedevicetokenactionenforceauth)
|
|
78
|
+
- [`duplicateDeviceTokenAction`](#duplicatedevicetokenaction)
|
|
79
|
+
- [`duplicateDeviceTokenMergePriority`](#duplicatedevicetokenmergepriority)
|
|
80
|
+
- [Configuration example](#configuration-example)
|
|
72
81
|
- [Localization](#localization)
|
|
73
82
|
- [Pages](#pages)
|
|
74
83
|
- [Localization with Directory Structure](#localization-with-directory-structure)
|
|
@@ -76,6 +85,7 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
|
|
|
76
85
|
- [Dynamic placeholders](#dynamic-placeholders)
|
|
77
86
|
- [Reserved Keys](#reserved-keys)
|
|
78
87
|
- [Parameters](#parameters-1)
|
|
88
|
+
- [Multi-Tenancy](#multi-tenancy)
|
|
79
89
|
- [Logging](#logging)
|
|
80
90
|
- [Deprecations](#deprecations)
|
|
81
91
|
- [Live Query](#live-query)
|
|
@@ -126,9 +136,9 @@ Before you start make sure you have installed:
|
|
|
126
136
|
Parse Server is continuously tested with the most recent releases of Node.js to ensure compatibility. We follow the [Node.js Long Term Support plan](https://github.com/nodejs/Release) and only test against versions that are officially supported and have not reached their end-of-life date.
|
|
127
137
|
|
|
128
138
|
| Version | Minimum Version | End-of-Life | Parse Server Support |
|
|
129
|
-
|
|
139
|
+
| ---------- | --------------- | ----------- | -------------------- |
|
|
130
140
|
| Node.js 18 | 18.20.4 | April 2025 | <= 8.x (2025) |
|
|
131
|
-
| Node.js 20 | 20.
|
|
141
|
+
| Node.js 20 | 20.19.0 | April 2026 | <= 9.x (2026) |
|
|
132
142
|
| Node.js 22 | 22.12.0 | April 2027 | <= 10.x (2027) |
|
|
133
143
|
| Node.js 24 | 24.11.0 | April 2028 | <= 11.x (2028) |
|
|
134
144
|
|
|
@@ -137,7 +147,7 @@ Parse Server is continuously tested with the most recent releases of Node.js to
|
|
|
137
147
|
Parse Server is continuously tested with the most recent releases of MongoDB to ensure compatibility. We follow the [MongoDB support schedule](https://www.mongodb.com/support-policy) and [MongoDB lifecycle schedule](https://www.mongodb.com/support-policy/lifecycles) and only test against versions that are officially supported and have not reached their end-of-life date. MongoDB "rapid releases" are ignored as these are considered pre-releases of the next major version.
|
|
138
148
|
|
|
139
149
|
| Version | Minimum Version | End-of-Life | Parse Server Support |
|
|
140
|
-
|
|
150
|
+
| --------- | --------------- | ----------- | -------------------- |
|
|
141
151
|
| MongoDB 6 | 6.0.19 | July 2025 | <= 8.x (2025) |
|
|
142
152
|
| MongoDB 7 | 7.0.16 | August 2026 | <= 9.x (2026) |
|
|
143
153
|
| MongoDB 8 | 8.0.4 | TDB | <= 10.x (2027) |
|
|
@@ -147,7 +157,7 @@ Parse Server is continuously tested with the most recent releases of MongoDB to
|
|
|
147
157
|
Parse Server is continuously tested with the most recent releases of PostgreSQL and PostGIS to ensure compatibility, using [PostGIS docker images](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&ordering=last_updated). We follow the [PostgreSQL support schedule](https://www.postgresql.org/support/versioning) and [PostGIS support schedule](https://www.postgis.net/eol_policy/) and only test against versions that are officially supported and have not reached their end-of-life date. Due to the extensive PostgreSQL support duration of 5 years, Parse Server drops support about 2 years before the official end-of-life date.
|
|
148
158
|
|
|
149
159
|
| Version | PostGIS Version | End-of-Life | Parse Server Support |
|
|
150
|
-
|
|
160
|
+
| ----------- | ----------------------- | ------------- | -------------------- |
|
|
151
161
|
| Postgres 13 | 3.1, 3.2, 3.3, 3.4, 3.5 | November 2025 | <= 6.x (2023) |
|
|
152
162
|
| Postgres 14 | 3.5 | November 2026 | <= 7.x (2024) |
|
|
153
163
|
| Postgres 15 | 3.3, 3.4, 3.5 | November 2027 | <= 8.x (2025) |
|
|
@@ -162,8 +172,8 @@ $ npm install -g parse-server mongodb-runner
|
|
|
162
172
|
$ mongodb-runner start
|
|
163
173
|
$ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://localhost/test
|
|
164
174
|
```
|
|
165
|
-
***Note:*** *If installation with* `-g` *fails due to permission problems* (`npm ERR! code 'EACCES'`), *please refer to [this link](https://docs.npmjs.com/getting-started/fixing-npm-permissions).*
|
|
166
175
|
|
|
176
|
+
**_Note:_** _If installation with_ `-g` _fails due to permission problems_ (`npm ERR! code 'EACCES'`), _please refer to [this link](https://docs.npmjs.com/getting-started/fixing-npm-permissions)._
|
|
167
177
|
|
|
168
178
|
### Docker Container
|
|
169
179
|
|
|
@@ -180,13 +190,13 @@ $ docker run --name my-mongo -d mongo
|
|
|
180
190
|
$ docker run --name my-parse-server -v config-vol:/parse-server/config -p 1337:1337 --link my-mongo:mongo -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test
|
|
181
191
|
```
|
|
182
192
|
|
|
183
|
-
|
|
193
|
+
**_Note:_** _If you want to use [Cloud Code](https://docs.parseplatform.org/cloudcode/guide/), add `-v cloud-code-vol:/parse-server/cloud --cloud /parse-server/cloud/main.js` to the command above. Make sure `main.js` is in the `cloud-code-vol` directory before starting Parse Server._
|
|
184
194
|
|
|
185
195
|
You can use any arbitrary string as your application id and master key. These will be used by your clients to authenticate with the Parse Server.
|
|
186
196
|
|
|
187
197
|
That's it! You are now running a standalone version of Parse Server on your machine.
|
|
188
198
|
|
|
189
|
-
**Using a remote MongoDB?** Pass the
|
|
199
|
+
**Using a remote MongoDB?** Pass the `--databaseURI DATABASE_URI` parameter when starting `parse-server`. Learn more about configuring Parse Server [here](#configuration). For a full list of available options, run `parse-server --help`.
|
|
190
200
|
|
|
191
201
|
### Saving and Querying Objects
|
|
192
202
|
|
|
@@ -204,17 +214,17 @@ Once you have a better understanding of how the project works, please refer to t
|
|
|
204
214
|
|
|
205
215
|
We have provided a basic [Node.js application](https://github.com/parse-community/parse-server-example) that uses the Parse Server module on Express and can be easily deployed to various infrastructure providers:
|
|
206
216
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
- [Heroku and mLab](https://devcenter.heroku.com/articles/deploying-a-parse-server-to-heroku)
|
|
218
|
+
- [AWS and Elastic Beanstalk](http://mobile.awsblog.com/post/TxCD57GZLM2JR/How-to-set-up-Parse-Server-on-AWS-using-AWS-Elastic-Beanstalk)
|
|
219
|
+
- [Google App Engine](https://medium.com/@justinbeckwith/deploying-parse-server-to-google-app-engine-6bc0b7451d50)
|
|
220
|
+
- [Microsoft Azure](https://azure.microsoft.com/en-us/blog/azure-welcomes-parse-developers/)
|
|
221
|
+
- [SashiDo](https://blog.sashido.io/tag/migration/)
|
|
222
|
+
- [Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-run-parse-server-on-ubuntu-14-04)
|
|
223
|
+
- [Pivotal Web Services](https://github.com/cf-platform-eng/pws-parse-server)
|
|
224
|
+
- [Back4app](https://www.back4app.com/docs/get-started/welcome)
|
|
225
|
+
- [Glitch](https://glitch.com/edit/#!/parse-server)
|
|
226
|
+
- [Flynn](https://flynn.io/blog/parse-apps-on-flynn)
|
|
227
|
+
- [Elestio](https://elest.io/open-source/parse)
|
|
218
228
|
|
|
219
229
|
### Parse Server + Express
|
|
220
230
|
|
|
@@ -231,7 +241,7 @@ const server = new ParseServer({
|
|
|
231
241
|
appId: 'myAppId',
|
|
232
242
|
masterKey: 'myMasterKey', // Keep this key secret!
|
|
233
243
|
fileKey: 'optionalFileKey',
|
|
234
|
-
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
|
|
244
|
+
serverURL: 'http://localhost:1337/parse', // Don't forget to change to https if needed
|
|
235
245
|
});
|
|
236
246
|
|
|
237
247
|
// Start server
|
|
@@ -240,7 +250,7 @@ await server.start();
|
|
|
240
250
|
// Serve the Parse API on the /parse URL prefix
|
|
241
251
|
app.use('/parse', server.app);
|
|
242
252
|
|
|
243
|
-
app.listen(1337, function() {
|
|
253
|
+
app.listen(1337, function () {
|
|
244
254
|
console.log('parse-server-example running on port 1337.');
|
|
245
255
|
});
|
|
246
256
|
```
|
|
@@ -262,7 +272,7 @@ The response looks like this:
|
|
|
262
272
|
### Status Values
|
|
263
273
|
|
|
264
274
|
| Value | Description |
|
|
265
|
-
|
|
275
|
+
| ------------- | --------------------------------------------------------------------------- |
|
|
266
276
|
| `initialized` | The server has been created but the `start` method has not been called yet. |
|
|
267
277
|
| `starting` | The server is starting up. |
|
|
268
278
|
| `ok` | The server started and is running. |
|
|
@@ -276,27 +286,27 @@ For the full list of available options, run `parse-server --help` or take a look
|
|
|
276
286
|
|
|
277
287
|
## Basic Options
|
|
278
288
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
289
|
+
- `appId` **(required)** - The application id to host with this server instance. You can use any arbitrary string. For migrated apps, this should match your hosted Parse app.
|
|
290
|
+
- `masterKey` **(required)** - The master key to use for overriding ACL security. You can use any arbitrary string. Keep it secret! For migrated apps, this should match your hosted Parse app.
|
|
291
|
+
- `databaseURI` **(required)** - The connection string for your database, i.e. `mongodb://user:pass@host.com/dbname`. Be sure to [URL encode your password](https://app.zencoder.com/docs/guides/getting-started/special-characters-in-usernames-and-passwords) if your password has special characters.
|
|
292
|
+
- `port` - The default port is 1337, specify this parameter to use a different port.
|
|
293
|
+
- `serverURL` - URL to your Parse Server (don't forget to specify http:// or https://). This URL will be used when making requests to Parse Server from Cloud Code.
|
|
294
|
+
- `cloud` - The absolute path to your cloud code `main.js` file.
|
|
295
|
+
- `push` - Configuration options for APNS and FCM push. See the [Push Notifications quick start](https://docs.parseplatform.org/parse-server/guide/#push-notifications-quick-start).
|
|
286
296
|
|
|
287
297
|
## Client Key Options
|
|
288
298
|
|
|
289
299
|
The client keys used with Parse are no longer necessary with Parse Server. If you wish to still require them, perhaps to be able to refuse access to older clients, you can set the keys at initialization time. Setting any of these keys will require all requests to provide one of the configured keys.
|
|
290
300
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
301
|
+
- `clientKey`
|
|
302
|
+
- `javascriptKey`
|
|
303
|
+
- `restAPIKey`
|
|
304
|
+
- `dotNetKey`
|
|
295
305
|
|
|
296
306
|
## Access Scopes
|
|
297
307
|
|
|
298
308
|
| Scope | Internal data | Read-only data <sub>(1)</sub> | Custom data | Restricted by CLP, ACL | Key |
|
|
299
|
-
|
|
309
|
+
| -------------- | ------------- | ----------------------------- | ----------- | ---------------------- | ------------------- |
|
|
300
310
|
| Internal | r/w | r/w | r/w | no | `maintenanceKey` |
|
|
301
311
|
| Master | -/- | r/- | r/w | no | `masterKey` |
|
|
302
312
|
| ReadOnlyMaster | -/- | r/- | r/- | no | `readOnlyMasterKey` |
|
|
@@ -304,6 +314,95 @@ The client keys used with Parse are no longer necessary with Parse Server. If yo
|
|
|
304
314
|
|
|
305
315
|
<sub>(1) `Parse.Object.createdAt`, `Parse.Object.updatedAt`.</sub>
|
|
306
316
|
|
|
317
|
+
> [!NOTE]
|
|
318
|
+
> In Cloud Code, both `masterKey` and `readOnlyMasterKey` set `request.master` to `true`. To distinguish between them, check `request.isReadOnly`. For example, use `request.master && !request.isReadOnly` to ensure full master key access.
|
|
319
|
+
|
|
320
|
+
## Route Allow List
|
|
321
|
+
|
|
322
|
+
The `routeAllowList` option restricts which REST API routes are accessible to external clients. When set, all external REST API requests are denied by default unless the route matches one of the configured regex patterns. This is useful for apps where all logic runs in Cloud Code and clients should not access the REST API directly.
|
|
323
|
+
|
|
324
|
+
Internal calls from Cloud Code, Cloud Jobs, and triggers are not affected. Master key and maintenance key requests bypass the restriction.
|
|
325
|
+
|
|
326
|
+
```js
|
|
327
|
+
const server = ParseServer({
|
|
328
|
+
...otherOptions,
|
|
329
|
+
routeAllowList: [
|
|
330
|
+
'classes/ChatMessage',
|
|
331
|
+
'classes/Public.*',
|
|
332
|
+
'users',
|
|
333
|
+
'login',
|
|
334
|
+
'functions/getMenu',
|
|
335
|
+
'health',
|
|
336
|
+
],
|
|
337
|
+
});
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Each entry is a regex pattern matched against the normalized route identifier. Patterns are auto-anchored with `^` and `$` for full-match semantics. For example, `classes/Chat` matches only `classes/Chat`, not `classes/ChatRoom`. Use `classes/Chat.*` to match both.
|
|
341
|
+
|
|
342
|
+
Setting an empty array `[]` blocks all external non-master-key REST API requests (full lockdown of REST API routes). Not setting the option preserves current behavior (all routes accessible).
|
|
343
|
+
|
|
344
|
+
### Covered Routes
|
|
345
|
+
|
|
346
|
+
The following table lists all route groups covered by `routeAllowList` with examples of how to allow them.
|
|
347
|
+
|
|
348
|
+
| Route group | Example route identifiers | Allow pattern |
|
|
349
|
+
| --- | --- | --- |
|
|
350
|
+
| **Data** | | |
|
|
351
|
+
| Classes | `classes/[className]`, `classes/[className]/[objectId]` | `classes/[className].*` |
|
|
352
|
+
| Aggregate | `aggregate/[className]` | `aggregate/.*` |
|
|
353
|
+
| Batch | `batch` | `batch` |
|
|
354
|
+
| Purge | `purge/[className]` | `purge/.*` |
|
|
355
|
+
| | | |
|
|
356
|
+
| **System Classes** | | |
|
|
357
|
+
| Users | `users`, `users/me`, `users/[objectId]` | `users.*` |
|
|
358
|
+
| Sessions | `sessions`, `sessions/me`, `sessions/[objectId]` | `sessions.*` |
|
|
359
|
+
| Installations | `installations`, `installations/[objectId]` | `installations.*` |
|
|
360
|
+
| Roles | `roles`, `roles/[objectId]` | `roles.*` |
|
|
361
|
+
| | | |
|
|
362
|
+
| **Auth** | | |
|
|
363
|
+
| Login | `login`, `loginAs` | `login.*` |
|
|
364
|
+
| Logout | `logout` | `logout` |
|
|
365
|
+
| Upgrade session | `upgradeToRevocableSession` | `upgradeToRevocableSession` |
|
|
366
|
+
| Auth challenge | `challenge` | `challenge` |
|
|
367
|
+
| Email verification | `verificationEmailRequest` | `verificationEmailRequest` |
|
|
368
|
+
| Password verification | `verifyPassword` | `verifyPassword` |
|
|
369
|
+
| Password reset | `requestPasswordReset` | `requestPasswordReset` |
|
|
370
|
+
| | | |
|
|
371
|
+
| **Cloud Code** | | |
|
|
372
|
+
| Cloud Functions | `functions/[functionName]` | `functions/.*` |
|
|
373
|
+
| Cloud Jobs (trigger) | `jobs`, `jobs/[jobName]` | `jobs.*` |
|
|
374
|
+
| Cloud Jobs (schedule) | `cloud_code/jobs`, `cloud_code/jobs/data`, `cloud_code/jobs/[objectId]` | `cloud_code/.*` |
|
|
375
|
+
| Hooks | `hooks/functions`, `hooks/triggers`, `hooks/functions/[functionName]`, `hooks/triggers/[className]/[triggerName]` | `hooks/.*` |
|
|
376
|
+
| | | |
|
|
377
|
+
| **Push** | | |
|
|
378
|
+
| Push | `push` | `push` |
|
|
379
|
+
| Push audiences | `push_audiences`, `push_audiences/[objectId]` | `push_audiences.*` |
|
|
380
|
+
| | | |
|
|
381
|
+
| **Schema** | | |
|
|
382
|
+
| Schemas | `schemas`, `schemas/[className]` | `schemas.*` |
|
|
383
|
+
| | | |
|
|
384
|
+
| **Config** | | |
|
|
385
|
+
| Config | `config` | `config` |
|
|
386
|
+
| GraphQL config | `graphql-config` | `graphql-config` |
|
|
387
|
+
| | | |
|
|
388
|
+
| **Analytics** | | |
|
|
389
|
+
| Analytics | `events/AppOpened`, `events/[eventName]` | `events/.*` |
|
|
390
|
+
| | | |
|
|
391
|
+
| **Server** | | |
|
|
392
|
+
| Health | `health` | `health` |
|
|
393
|
+
| Server info | `serverInfo` | `serverInfo` |
|
|
394
|
+
| Security | `security` | `security` |
|
|
395
|
+
| Logs | `scriptlog` | `scriptlog` |
|
|
396
|
+
| | | |
|
|
397
|
+
| **Legacy** | | |
|
|
398
|
+
| Purchase validation | `validate_purchase` | `validate_purchase` |
|
|
399
|
+
|
|
400
|
+
> [!NOTE]
|
|
401
|
+
> File routes are not covered by `routeAllowList`. File upload access is controlled via the `fileUpload` option. File download and metadata access is controlled via the `fileDownload` option.
|
|
402
|
+
|
|
403
|
+
> [!NOTE]
|
|
404
|
+
> The GraphQL API is not covered by `routeAllowList`. `routeAllowList` gates the REST API per route, while every GraphQL operation is transported over a single endpoint with the operation, target class, and field set encoded in the request body — so per-route allow-list semantics do not compose with it.
|
|
405
|
+
|
|
307
406
|
## Email Verification and Password Reset
|
|
308
407
|
|
|
309
408
|
Verifying user email addresses and enabling password reset via email requires an email adapter. There are many email adapters provided and maintained by the community. The following is an example configuration with an example email adapter. See the [Parse Server Options][server-options] for more details and a full list of available options.
|
|
@@ -323,16 +422,18 @@ const server = ParseServer({
|
|
|
323
422
|
module: 'example-mail-adapter',
|
|
324
423
|
options: {
|
|
325
424
|
// Additional adapter options
|
|
326
|
-
...mailAdapterOptions
|
|
327
|
-
}
|
|
425
|
+
...mailAdapterOptions,
|
|
426
|
+
},
|
|
328
427
|
},
|
|
329
428
|
});
|
|
330
429
|
```
|
|
331
430
|
|
|
332
431
|
Offical email adapters maintained by Parse Platform:
|
|
432
|
+
|
|
333
433
|
- [parse-server-api-mail-adapter](https://github.com/parse-community/parse-server-api-mail-adapter) (localization, templates, universally supports any email provider)
|
|
334
434
|
|
|
335
435
|
Email adapters contributed by the community:
|
|
436
|
+
|
|
336
437
|
- [parse-smtp-template](https://www.npmjs.com/package/parse-smtp-template) (localization, templates)
|
|
337
438
|
- [parse-server-postmark-adapter](https://www.npmjs.com/package/parse-server-postmark-adapter)
|
|
338
439
|
- [parse-server-sendgrid-adapter](https://www.npmjs.com/package/parse-server-sendgrid-adapter)
|
|
@@ -385,7 +486,6 @@ const api = new ParseServer({
|
|
|
385
486
|
...otherOptions,
|
|
386
487
|
|
|
387
488
|
pages: {
|
|
388
|
-
enableRouter: true,
|
|
389
489
|
customRoutes: [{
|
|
390
490
|
method: 'GET',
|
|
391
491
|
path: 'custom_route',
|
|
@@ -410,7 +510,7 @@ The `handler` receives the `request` and returns a `custom_page.html` webpage fr
|
|
|
410
510
|
The following paths are already used by Parse Server's built-in features and are therefore not available for custom routes. Custom routes with an identical combination of `path` and `method` are ignored.
|
|
411
511
|
|
|
412
512
|
| Path | HTTP Method | Feature |
|
|
413
|
-
|
|
513
|
+
| --------------------------- | ----------- | ------------------ |
|
|
414
514
|
| `verify_email` | `GET` | email verification |
|
|
415
515
|
| `resend_verification_email` | `POST` | email verification |
|
|
416
516
|
| `choose_password` | `GET` | password reset |
|
|
@@ -420,9 +520,8 @@ The following paths are already used by Parse Server's built-in features and are
|
|
|
420
520
|
### Parameters
|
|
421
521
|
|
|
422
522
|
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
|
|
423
|
-
|
|
523
|
+
| ---------------------------- | -------- | --------------- | ------------- | --------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
424
524
|
| `pages` | yes | `Object` | `undefined` | - | `PARSE_SERVER_PAGES` | The options for pages such as password reset and email verification. |
|
|
425
|
-
| `pages.enableRouter` | yes | `Boolean` | `false` | - | `PARSE_SERVER_PAGES_ENABLE_ROUTER` | Is `true` if the pages router should be enabled; this is required for any of the pages options to take effect. |
|
|
426
525
|
| `pages.customRoutes` | yes | `Array` | `[]` | - | `PARSE_SERVER_PAGES_CUSTOM_ROUTES` | The custom routes. The routes are added in the order they are defined here, which has to be considered since requests traverse routes in an ordered manner. Custom routes are traversed after build-in routes such as password reset and email verification. |
|
|
427
526
|
| `pages.customRoutes.method` | | `String` | - | `GET`, `POST` | - | The HTTP method of the custom route. |
|
|
428
527
|
| `pages.customRoutes.path` | | `String` | - | `custom_page` | - | The path of the custom route. Note that the same path can used if the `method` is different, for example a path `custom_page` can have two routes, a `GET` and `POST` route, which will be invoked depending on the HTTP request method. |
|
|
@@ -437,16 +536,16 @@ const server = ParseServer({
|
|
|
437
536
|
...otherOptions,
|
|
438
537
|
|
|
439
538
|
customPages: {
|
|
440
|
-
passwordResetSuccess:
|
|
441
|
-
verifyEmailSuccess:
|
|
442
|
-
parseFrameURL:
|
|
443
|
-
linkSendSuccess:
|
|
444
|
-
linkSendFail:
|
|
445
|
-
invalidLink:
|
|
446
|
-
invalidVerificationLink:
|
|
447
|
-
choosePassword:
|
|
448
|
-
}
|
|
449
|
-
})
|
|
539
|
+
passwordResetSuccess: 'http://yourapp.com/passwordResetSuccess',
|
|
540
|
+
verifyEmailSuccess: 'http://yourapp.com/verifyEmailSuccess',
|
|
541
|
+
parseFrameURL: 'http://yourapp.com/parseFrameURL',
|
|
542
|
+
linkSendSuccess: 'http://yourapp.com/linkSendSuccess',
|
|
543
|
+
linkSendFail: 'http://yourapp.com/linkSendFail',
|
|
544
|
+
invalidLink: 'http://yourapp.com/invalidLink',
|
|
545
|
+
invalidVerificationLink: 'http://yourapp.com/invalidVerificationLink',
|
|
546
|
+
choosePassword: 'http://yourapp.com/choosePassword',
|
|
547
|
+
},
|
|
548
|
+
});
|
|
450
549
|
```
|
|
451
550
|
|
|
452
551
|
## Using Environment Variables
|
|
@@ -482,13 +581,40 @@ You can also find more adapters maintained by the community by searching on [npm
|
|
|
482
581
|
|
|
483
582
|
Parse Server allows developers to choose from several options when hosting files:
|
|
484
583
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
584
|
+
- `GridFSBucketAdapter` - which is backed by MongoDB
|
|
585
|
+
- `S3Adapter` - which is backed by [Amazon S3](https://aws.amazon.com/s3/)
|
|
586
|
+
- `GCSAdapter` - which is backed by [Google Cloud Storage](https://cloud.google.com/storage/)
|
|
587
|
+
- `FSAdapter` - local file storage
|
|
489
588
|
|
|
490
589
|
`GridFSBucketAdapter` is used by default and requires no setup, but if you're interested in using Amazon S3, Google Cloud Storage, or local file storage, additional configuration information is available in the [Parse Server guide](http://docs.parseplatform.org/parse-server/guide/#configuring-file-adapters).
|
|
491
590
|
|
|
591
|
+
### Restricting File URL Domains
|
|
592
|
+
|
|
593
|
+
Parse objects can reference files by URL. To prevent [SSRF attacks](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery) via crafted file URLs, you can restrict the allowed URL domains using the `fileUpload.allowedFileUrlDomains` option.
|
|
594
|
+
|
|
595
|
+
This protects against scenarios where an attacker provides a `Parse.File` with an arbitrary URL, for example as a Cloud Function parameter or in a field of type `Object` or `Array`. If Cloud Code or a client calls `getData()` on such a file, the Parse SDK makes an HTTP request to that URL, potentially leaking the server or client IP address and accessing internal services.
|
|
596
|
+
|
|
597
|
+
> [!NOTE]
|
|
598
|
+
> Fields of type `Parse.File` in the Parse schema are not affected by this attack, because Parse Server discards the URL on write and dynamically generates it on read based on the file adapter configuration.
|
|
599
|
+
|
|
600
|
+
```javascript
|
|
601
|
+
const parseServer = new ParseServer({
|
|
602
|
+
...otherOptions,
|
|
603
|
+
fileUpload: {
|
|
604
|
+
allowedFileUrlDomains: ['cdn.example.com', '*.example.com'],
|
|
605
|
+
},
|
|
606
|
+
});
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
| Parameter | Optional | Type | Default | Environment Variable |
|
|
610
|
+
|---|---|---|---|---|
|
|
611
|
+
| `fileUpload.allowedFileUrlDomains` | yes | `String[]` | `['*']` | `PARSE_SERVER_FILE_UPLOAD_ALLOWED_FILE_URL_DOMAINS` |
|
|
612
|
+
|
|
613
|
+
- `['*']` (default) allows file URLs with any domain.
|
|
614
|
+
- `['cdn.example.com']` allows only exact hostname matches.
|
|
615
|
+
- `['*.example.com']` allows any subdomain of `example.com`.
|
|
616
|
+
- `[]` blocks all file URLs; only files referenced by name are allowed.
|
|
617
|
+
|
|
492
618
|
## Idempotency Enforcement
|
|
493
619
|
|
|
494
620
|
**Caution, this is an experimental feature that may not be appropriate for production.**
|
|
@@ -515,7 +641,7 @@ let api = new ParseServer({
|
|
|
515
641
|
### Parameters <!-- omit in toc -->
|
|
516
642
|
|
|
517
643
|
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
|
|
518
|
-
|
|
644
|
+
| -------------------------- | -------- | --------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
519
645
|
| `idempotencyOptions` | yes | `Object` | `undefined` | | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS | Setting this enables idempotency enforcement for the specified paths. |
|
|
520
646
|
| `idempotencyOptions.paths` | yes | `Array<String>` | `[]` | `.*` (all paths, includes the examples below), <br>`functions/.*` (all functions), <br>`jobs/.*` (all jobs), <br>`classes/.*` (all classes), <br>`functions/.*` (all functions), <br>`users` (user creation / update), <br>`installations` (installation creation / update) | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_PATHS | An array of path patterns that have to match the request path for request deduplication to be enabled. The mount path must not be included, for example to match the request path `/parse/functions/myFunction` specify the path pattern `functions/myFunction`. A trailing slash of the request path is ignored, for example the path pattern `functions/myFunction` matches both `/parse/functions/myFunction` and `/parse/functions/myFunction/`. |
|
|
521
647
|
| `idempotencyOptions.ttl` | yes | `Integer` | `300` | `60` (60 seconds) | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_TTL | The duration in seconds after which a request record is discarded from the database. Duplicate requests due to network issues can be expected to arrive within milliseconds up to several seconds. This value must be greater than `0`. |
|
|
@@ -541,6 +667,49 @@ Assuming the script above is named, `parse_idempotency_delete_expired_records.sh
|
|
|
541
667
|
2 * * * * /root/parse_idempotency_delete_expired_records.sh >/dev/null 2>&1
|
|
542
668
|
```
|
|
543
669
|
|
|
670
|
+
## Installations
|
|
671
|
+
|
|
672
|
+
Parse Server deduplicates `_Installation` records when a new install collides with an existing row's `deviceToken`. The `installation` option block configures the dedup behavior.
|
|
673
|
+
|
|
674
|
+
### Options
|
|
675
|
+
|
|
676
|
+
| Parameter | Optional | Type | Default | Environment Variable |
|
|
677
|
+
|---|---|---|---|---|
|
|
678
|
+
| `installation.duplicateDeviceTokenActionEnforceAuth` | yes | `Boolean` | `false` | `PARSE_SERVER_INSTALLATION_DUPLICATE_DEVICE_TOKEN_ACTION_ENFORCE_AUTH` |
|
|
679
|
+
| `installation.duplicateDeviceTokenAction` | yes | `String` | `'delete'` | `PARSE_SERVER_INSTALLATION_DUPLICATE_DEVICE_TOKEN_ACTION` |
|
|
680
|
+
| `installation.duplicateDeviceTokenMergePriority` | yes | `String` | `'deviceToken'` | `PARSE_SERVER_INSTALLATION_DUPLICATE_DEVICE_TOKEN_MERGE_PRIORITY` |
|
|
681
|
+
|
|
682
|
+
#### `duplicateDeviceTokenActionEnforceAuth`
|
|
683
|
+
|
|
684
|
+
When `true`, the dedup operation runs with the caller's auth context so ACL and CLP are honored. When `false`, the dedup runs as master and bypasses both. Master and maintenance keys always bypass regardless of this flag.
|
|
685
|
+
|
|
686
|
+
#### `duplicateDeviceTokenAction`
|
|
687
|
+
|
|
688
|
+
What Parse Server does to the conflicting `_Installation` row(s) when a new install's `deviceToken` collides with an existing row.
|
|
689
|
+
|
|
690
|
+
- `'delete'`: destroys the conflicting row.
|
|
691
|
+
- `'update'`: clears the now-conflicting ID field on the conflicting row, preserving custom fields, channels, and history.
|
|
692
|
+
|
|
693
|
+
#### `duplicateDeviceTokenMergePriority`
|
|
694
|
+
|
|
695
|
+
When an existing row holds the new `deviceToken` but has no `installationId` of its own, Parse Server merges the two rows. This option controls which side wins.
|
|
696
|
+
|
|
697
|
+
- `'deviceToken'`: the deviceToken-only row survives; the request's installationId-matched row is the loser.
|
|
698
|
+
- `'installationId'`: the request's installationId-matched row survives; the deviceToken-only orphan is the loser.
|
|
699
|
+
|
|
700
|
+
### Configuration example
|
|
701
|
+
|
|
702
|
+
```javascript
|
|
703
|
+
const parseServer = new ParseServer({
|
|
704
|
+
...otherOptions,
|
|
705
|
+
installation: {
|
|
706
|
+
duplicateDeviceTokenActionEnforceAuth: true,
|
|
707
|
+
duplicateDeviceTokenAction: 'update',
|
|
708
|
+
duplicateDeviceTokenMergePriority: 'installationId',
|
|
709
|
+
},
|
|
710
|
+
});
|
|
711
|
+
```
|
|
712
|
+
|
|
544
713
|
## Localization
|
|
545
714
|
|
|
546
715
|
### Pages
|
|
@@ -552,18 +721,19 @@ const api = new ParseServer({
|
|
|
552
721
|
...otherOptions,
|
|
553
722
|
|
|
554
723
|
pages: {
|
|
555
|
-
enableRouter: true,
|
|
556
724
|
enableLocalization: true,
|
|
557
725
|
}
|
|
558
726
|
}
|
|
559
727
|
```
|
|
560
728
|
|
|
561
729
|
Localization is achieved by matching a request-supplied `locale` parameter with localized page content. The locale can be supplied in either the request query, body or header with the following keys:
|
|
730
|
+
|
|
562
731
|
- query: `locale`
|
|
563
732
|
- body: `locale`
|
|
564
733
|
- header: `x-parse-page-param-locale`
|
|
565
734
|
|
|
566
735
|
For example, a password reset link with the locale parameter in the query could look like this:
|
|
736
|
+
|
|
567
737
|
```
|
|
568
738
|
http://example.com/parse/apps/[appId]/request_password_reset?token=[token]&username=[username]&locale=de-AT
|
|
569
739
|
```
|
|
@@ -579,6 +749,7 @@ Pages can be localized in two ways:
|
|
|
579
749
|
Pages are localized by using the corresponding file in the directory structure where the files are placed in subdirectories named after the locale or language. The file in the base directory is the default file.
|
|
580
750
|
|
|
581
751
|
**Example Directory Structure:**
|
|
752
|
+
|
|
582
753
|
```js
|
|
583
754
|
root/
|
|
584
755
|
├── public/ // pages base path
|
|
@@ -590,17 +761,18 @@ root/
|
|
|
590
761
|
```
|
|
591
762
|
|
|
592
763
|
Files are matched with the locale in the following order:
|
|
764
|
+
|
|
593
765
|
1. Locale match, e.g. locale `de-AT` matches file in folder `de-AT`.
|
|
594
766
|
1. Language match, e.g. locale `de-CH` matches file in folder `de`.
|
|
595
767
|
1. Default; file in base folder is returned.
|
|
596
768
|
|
|
597
769
|
**Configuration Example:**
|
|
770
|
+
|
|
598
771
|
```js
|
|
599
772
|
const api = new ParseServer({
|
|
600
773
|
...otherOptions,
|
|
601
774
|
|
|
602
775
|
pages: {
|
|
603
|
-
enableRouter: true,
|
|
604
776
|
enableLocalization: true,
|
|
605
777
|
customUrls: {
|
|
606
778
|
passwordReset: 'https://example.com/page.html'
|
|
@@ -610,9 +782,11 @@ const api = new ParseServer({
|
|
|
610
782
|
```
|
|
611
783
|
|
|
612
784
|
Pros:
|
|
785
|
+
|
|
613
786
|
- All files are complete in their content and can be easily opened and previewed by viewing the file in a browser.
|
|
614
787
|
|
|
615
788
|
Cons:
|
|
789
|
+
|
|
616
790
|
- In most cases, a localized page differs only slightly from the default page, which could cause a lot of duplicate code that is difficult to maintain.
|
|
617
791
|
|
|
618
792
|
#### Localization with JSON Resource
|
|
@@ -620,6 +794,7 @@ Cons:
|
|
|
620
794
|
Pages are localized by adding placeholders in the HTML files and providing a JSON resource that contains the translations to fill into the placeholders.
|
|
621
795
|
|
|
622
796
|
**Example Directory Structure:**
|
|
797
|
+
|
|
623
798
|
```js
|
|
624
799
|
root/
|
|
625
800
|
├── public/ // pages base path
|
|
@@ -631,6 +806,7 @@ root/
|
|
|
631
806
|
The JSON resource file loosely follows the [i18next](https://github.com/i18next/i18next) syntax, which is a syntax that is often supported by translation platforms, making it easy to manage translations, exporting them for use in Parse Server, and even to automate this workflow.
|
|
632
807
|
|
|
633
808
|
**Example JSON Content:**
|
|
809
|
+
|
|
634
810
|
```json
|
|
635
811
|
{
|
|
636
812
|
"en": { // resource for language `en` (English)
|
|
@@ -652,12 +828,12 @@ The JSON resource file loosely follows the [i18next](https://github.com/i18next/
|
|
|
652
828
|
```
|
|
653
829
|
|
|
654
830
|
**Configuration Example:**
|
|
831
|
+
|
|
655
832
|
```js
|
|
656
833
|
const api = new ParseServer({
|
|
657
834
|
...otherOptions,
|
|
658
835
|
|
|
659
836
|
pages: {
|
|
660
|
-
enableRouter: true,
|
|
661
837
|
enableLocalization: true,
|
|
662
838
|
localizationJsonPath: './private/localization.json',
|
|
663
839
|
localizationFallbackLocale: 'en'
|
|
@@ -666,9 +842,11 @@ const api = new ParseServer({
|
|
|
666
842
|
```
|
|
667
843
|
|
|
668
844
|
Pros:
|
|
845
|
+
|
|
669
846
|
- There is only one HTML file to maintain that contains the placeholders that are filled with the translations according to the locale.
|
|
670
847
|
|
|
671
848
|
Cons:
|
|
849
|
+
|
|
672
850
|
- Files cannot be easily previewed by viewing the file in a browser because the content contains only placeholders and even HTML or CSS changes may be dynamically applied, e.g. when a localization requires a Right-To-Left layout direction.
|
|
673
851
|
- Style and other fundamental layout changes may be more difficult to apply.
|
|
674
852
|
|
|
@@ -677,18 +855,19 @@ Cons:
|
|
|
677
855
|
In addition to feature related default parameters such as `appId` and the translations provided via JSON resource, it is possible to define custom dynamic placeholders as part of the router configuration. This works independently of localization and, also if `enableLocalization` is disabled.
|
|
678
856
|
|
|
679
857
|
**Configuration Example:**
|
|
858
|
+
|
|
680
859
|
```js
|
|
681
860
|
const api = new ParseServer({
|
|
682
861
|
...otherOptions,
|
|
683
862
|
|
|
684
863
|
pages: {
|
|
685
|
-
enableRouter: true,
|
|
686
864
|
placeholders: {
|
|
687
865
|
exampleKey: 'exampleValue'
|
|
688
866
|
}
|
|
689
867
|
}
|
|
690
868
|
}
|
|
691
869
|
```
|
|
870
|
+
|
|
692
871
|
The placeholders can also be provided as function or as async function, with the `locale` and other feature related parameters passed through, to allow for dynamic placeholder values:
|
|
693
872
|
|
|
694
873
|
```js
|
|
@@ -696,7 +875,6 @@ const api = new ParseServer({
|
|
|
696
875
|
...otherOptions,
|
|
697
876
|
|
|
698
877
|
pages: {
|
|
699
|
-
enableRouter: true,
|
|
700
878
|
placeholders: async (params) => {
|
|
701
879
|
const value = await doSomething(params.locale);
|
|
702
880
|
return {
|
|
@@ -714,9 +892,8 @@ The following parameter and placeholder keys are reserved because they are used
|
|
|
714
892
|
#### Parameters
|
|
715
893
|
|
|
716
894
|
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
|
|
717
|
-
|
|
895
|
+
| ----------------------------------------------- | -------- | ------------------------------------- | -------------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
718
896
|
| `pages` | yes | `Object` | `undefined` | - | `PARSE_SERVER_PAGES` | The options for pages such as password reset and email verification. |
|
|
719
|
-
| `pages.enableRouter` | yes | `Boolean` | `false` | - | `PARSE_SERVER_PAGES_ENABLE_ROUTER` | Is `true` if the pages router should be enabled; this is required for any of the pages options to take effect. |
|
|
720
897
|
| `pages.enableLocalization` | yes | `Boolean` | `false` | - | `PARSE_SERVER_PAGES_ENABLE_LOCALIZATION` | Is true if pages should be localized; this has no effect on custom page redirects. |
|
|
721
898
|
| `pages.localizationJsonPath` | yes | `String` | `undefined` | `./private/translations.json` | `PARSE_SERVER_PAGES_LOCALIZATION_JSON_PATH` | The path to the JSON file for localization; the translations will be used to fill template placeholders according to the locale. |
|
|
722
899
|
| `pages.localizationFallbackLocale` | yes | `String` | `en` | `en`, `en-GB`, `default` | `PARSE_SERVER_PAGES_LOCALIZATION_FALLBACK_LOCALE` | The fallback locale for localization if no matching translation is provided for the given locale. This is only relevant when providing translation resources via JSON file. |
|
|
@@ -738,21 +915,26 @@ The following parameter and placeholder keys are reserved because they are used
|
|
|
738
915
|
|
|
739
916
|
- In combination with the [Parse Server API Mail Adapter](https://www.npmjs.com/package/parse-server-api-mail-adapter) Parse Server provides a fully localized flow (emails -> pages) for the user. The email adapter sends a localized email and adds a locale parameter to the password reset or email verification link, which is then used to respond with localized pages.
|
|
740
917
|
|
|
918
|
+
## Multi-Tenancy
|
|
919
|
+
|
|
920
|
+
Parse Server does not support multi-tenancy. Only one Parse Server instance may be mounted per Express app. Among other considerations, there is no isolation between apps in the same process. For example, Cloud Code runs in the same Node.js process as Parse Server and has full access to the server environment, such as server configuration, modules, and environment variables.
|
|
921
|
+
|
|
741
922
|
## Logging
|
|
742
923
|
|
|
743
924
|
Parse Server will, by default, log:
|
|
744
|
-
|
|
745
|
-
|
|
925
|
+
|
|
926
|
+
- to the console
|
|
927
|
+
- daily rotating files as new line delimited JSON
|
|
746
928
|
|
|
747
929
|
Logs are also viewable in Parse Dashboard.
|
|
748
930
|
|
|
749
|
-
**Want to log each request and response?** Set the `VERBOSE` environment variable when starting `parse-server`. Usage :-
|
|
931
|
+
**Want to log each request and response?** Set the `VERBOSE` environment variable when starting `parse-server`. Usage :- `VERBOSE='1' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY`
|
|
750
932
|
|
|
751
|
-
**Want logs to be placed in a different folder?** Pass the `PARSE_SERVER_LOGS_FOLDER` environment variable when starting `parse-server`. Usage :-
|
|
933
|
+
**Want logs to be placed in a different folder?** Pass the `PARSE_SERVER_LOGS_FOLDER` environment variable when starting `parse-server`. Usage :- `PARSE_SERVER_LOGS_FOLDER='<path-to-logs-folder>' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY`
|
|
752
934
|
|
|
753
|
-
**Want to log specific levels?** Pass the `logLevel` parameter when starting `parse-server`. Usage :-
|
|
935
|
+
**Want to log specific levels?** Pass the `logLevel` parameter when starting `parse-server`. Usage :- `parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --logLevel LOG_LEVEL`
|
|
754
936
|
|
|
755
|
-
**Want new line delimited JSON error logs (for consumption by CloudWatch, Google Cloud Logging, etc)?** Pass the `JSON_LOGS` environment variable when starting `parse-server`. Usage :-
|
|
937
|
+
**Want new line delimited JSON error logs (for consumption by CloudWatch, Google Cloud Logging, etc)?** Pass the `JSON_LOGS` environment variable when starting `parse-server`. Usage :- `JSON_LOGS='1' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY`
|
|
756
938
|
|
|
757
939
|
# Deprecations
|
|
758
940
|
|
|
@@ -782,7 +964,7 @@ $ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongo
|
|
|
782
964
|
|
|
783
965
|
After starting the server, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
|
|
784
966
|
|
|
785
|
-
|
|
967
|
+
**_Note:_** Do **_NOT_** use --mountPlayground option in production. The GraphQL Playground exposes the master key in the browser page. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and is the recommended option for production apps.
|
|
786
968
|
|
|
787
969
|
### Using Docker
|
|
788
970
|
|
|
@@ -801,11 +983,11 @@ $ docker run --name my-mongo -d mongo
|
|
|
801
983
|
$ docker run --name my-parse-server --link my-mongo:mongo -v config-vol:/parse-server/config -p 1337:1337 -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test --publicServerURL http://localhost:1337/parse --mountGraphQL --mountPlayground
|
|
802
984
|
```
|
|
803
985
|
|
|
804
|
-
|
|
986
|
+
**_Note:_** _If you want to use [Cloud Code](https://docs.parseplatform.org/cloudcode/guide/), add `-v cloud-code-vol:/parse-server/cloud --cloud /parse-server/cloud/main.js` to the command above. Make sure `main.js` is in the `cloud-code-vol` directory before starting Parse Server._
|
|
805
987
|
|
|
806
988
|
After starting the server, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
|
|
807
989
|
|
|
808
|
-
|
|
990
|
+
**_Note:_** Do **_NOT_** use --mountPlayground option in production. The GraphQL Playground exposes the master key in the browser page. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and is the recommended option for production apps.
|
|
809
991
|
|
|
810
992
|
### Using Express.js
|
|
811
993
|
|
|
@@ -830,23 +1012,20 @@ const parseServer = new ParseServer({
|
|
|
830
1012
|
appId: 'APPLICATION_ID',
|
|
831
1013
|
masterKey: 'MASTER_KEY',
|
|
832
1014
|
serverURL: 'http://localhost:1337/parse',
|
|
833
|
-
publicServerURL: 'http://localhost:1337/parse'
|
|
1015
|
+
publicServerURL: 'http://localhost:1337/parse',
|
|
834
1016
|
});
|
|
835
1017
|
|
|
836
|
-
const parseGraphQLServer = new ParseGraphQLServer(
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
playgroundPath: '/playground'
|
|
841
|
-
}
|
|
842
|
-
);
|
|
1018
|
+
const parseGraphQLServer = new ParseGraphQLServer(parseServer, {
|
|
1019
|
+
graphQLPath: '/graphql',
|
|
1020
|
+
playgroundPath: '/playground',
|
|
1021
|
+
});
|
|
843
1022
|
|
|
844
1023
|
app.use('/parse', parseServer.app); // (Optional) Mounts the REST API
|
|
845
1024
|
parseGraphQLServer.applyGraphQL(app); // Mounts the GraphQL API
|
|
846
1025
|
parseGraphQLServer.applyPlayground(app); // (Optional) Mounts the GraphQL Playground - do NOT use in Production
|
|
847
1026
|
|
|
848
1027
|
await parseServer.start();
|
|
849
|
-
app.listen(1337, function() {
|
|
1028
|
+
app.listen(1337, function () {
|
|
850
1029
|
console.log('REST API running on http://localhost:1337/parse');
|
|
851
1030
|
console.log('GraphQL API running on http://localhost:1337/graphql');
|
|
852
1031
|
console.log('GraphQL Playground running on http://localhost:1337/playground');
|
|
@@ -862,7 +1041,7 @@ $ node index.js
|
|
|
862
1041
|
|
|
863
1042
|
After starting the app, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
|
|
864
1043
|
|
|
865
|
-
|
|
1044
|
+
**_Note:_** Do **_NOT_** mount the GraphQL Playground in production. The GraphQL Playground exposes the master key in the browser page. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and is the recommended option for production apps.
|
|
866
1045
|
|
|
867
1046
|
## Checking the API health
|
|
868
1047
|
|
|
@@ -957,13 +1136,7 @@ Run the following to create your first object:
|
|
|
957
1136
|
|
|
958
1137
|
```graphql
|
|
959
1138
|
mutation CreateGameScore {
|
|
960
|
-
createGameScore(
|
|
961
|
-
fields: {
|
|
962
|
-
playerName: "Sean Plott"
|
|
963
|
-
score: 1337
|
|
964
|
-
cheatMode: false
|
|
965
|
-
}
|
|
966
|
-
) {
|
|
1139
|
+
createGameScore(fields: { playerName: "Sean Plott", score: 1337, cheatMode: false }) {
|
|
967
1140
|
id
|
|
968
1141
|
updatedAt
|
|
969
1142
|
createdAt
|
|
@@ -1142,4 +1315,5 @@ Support us with a monthly donation and help us continue our activities. [Become
|
|
|
1142
1315
|
[log_release]: https://github.com/parse-community/parse-server/blob/release/changelogs/CHANGELOG_release.md
|
|
1143
1316
|
[log_beta]: https://github.com/parse-community/parse-server/blob/beta/changelogs/CHANGELOG_beta.md
|
|
1144
1317
|
[log_alpha]: https://github.com/parse-community/parse-server/blob/alpha/changelogs/CHANGELOG_alpha.md
|
|
1318
|
+
|
|
1145
1319
|
[server-options] http://parseplatform.org/parse-server/api/release/ParseServerOptions.html
|