You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Asynchronous initialization of Parse Server (#8232)
BREAKING CHANGE: This release introduces the asynchronous initialization of Parse Server to prevent mounting Parse Server before being ready to receive request; it changes how Parse Server is imported, initialized and started; it also removes the callback `serverStartComplete`; see the [Parse Server 6 migration guide](https://github.com/parse-community/parse-server/blob/alpha/6.0.0.md) for more details (#8232)
# Parse Server 6 Migration Guide <!-- omit in toc -->
2
+
3
+
This document only highlights specific changes that require a longer explanation. For a full list of changes in Parse Server 6 please refer to the [changelog](https://github.com/parse-community/parse-server/blob/alpha/CHANGELOG.md).
The import and initialization syntax has been simplified with more intuitive naming and structure.
15
+
16
+
*Parse Server 5:*
17
+
```js
18
+
// Returns a Parse Server instance
19
+
constParseServer=require('parse-server');
20
+
21
+
// Returns a Parse Server express middleware
22
+
const { ParseServer } =require('parse-server');
23
+
```
24
+
25
+
*Parse Server 6:*
26
+
```js
27
+
// Both return a Parse Server instance
28
+
constParseServer=require('parse-server');
29
+
const { ParseServer } =require('parse-server');
30
+
```
31
+
32
+
To get the express middleware in Parse Server 6, configure the Parse Server instance, start Parse Server and use its `app` property. See [Asynchronous Initialization](#asynchronous-initialization) for more details.
33
+
34
+
## Asynchronous Initialization
35
+
36
+
Previously, it was possible to mount Parse Server before it was fully started up and ready to receive requests. This could result in undefined behavior, such as Parse Objects could be saved before Cloud Code was registered. To prevent this, Parse Server 6 requires to be started asynchronously before being mounted.
37
+
38
+
*Parse Server 5:*
39
+
```js
40
+
// 1. Import Parse Server
41
+
const { ParseServer } =require('parse-server');
42
+
43
+
// 2. Create a Parse Server instance as express middleware
Copy file name to clipboardexpand all lines: README.md
+42-15
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
40
40
41
41
---
42
42
43
-
-[Flavors & Branches](#flavors--branches)
43
+
-[Flavors \& Branches](#flavors--branches)
44
44
-[Long Term Support](#long-term-support)
45
45
-[Getting Started](#getting-started)
46
46
-[Running Parse Server](#running-parse-server)
@@ -55,6 +55,8 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
55
55
-[Running Parse Server elsewhere](#running-parse-server-elsewhere)
56
56
-[Sample Application](#sample-application)
57
57
-[Parse Server + Express](#parse-server--express)
58
+
-[Parse Server Health](#parse-server-health)
59
+
-[Status Values](#status-values)
58
60
-[Configuration](#configuration)
59
61
-[Basic Options](#basic-options)
60
62
-[Client Key Options](#client-key-options)
@@ -136,13 +138,13 @@ Parse Server is continuously tested with the most recent releases of Node.js to
136
138
137
139
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. We consider the end-of-life date of a MongoDB "rapid release" to be the same as its major version release.
138
140
139
-
| Version | Latest Version | End-of-Life | Compatible |
For a full list of available options, run `parse-server --help` or take a look at [Parse Server Configurations](http://parseplatform.org/parse-server/api/master/ParseServerOptions.html).
307
312
313
+
## Parse Server Health
314
+
315
+
Check the Parse Server health by sending a request to the `/parse/health` endpoint.
|`initialized`| The server has been created but the `start` method has not been called yet. |
330
+
|`starting`| The server is starting up. |
331
+
|`ok`| The server started and is running. |
332
+
|`error`| There was a startup error, see the logs for details. |
333
+
308
334
# Configuration
309
335
310
336
Parse Server can be configured using the following options. You may pass these as parameters when running a standalone `parse-server`, or by loading a configuration file in JSON format using `parse-server path/to/configuration.json`. If you're using Parse Server on Express, you may also pass these to the `ParseServer` object as options.
@@ -461,7 +487,7 @@ The following paths are already used by Parse Server's built-in features and are
461
487
It’s possible to change the default pages of the app and redirect the user to another path or domain.
462
488
463
489
```js
464
-
var server = ParseServer({
490
+
const server = ParseServer({
465
491
...otherOptions,
466
492
467
493
customPages: {
@@ -851,7 +877,7 @@ Then, create an `index.js` file with the following content:
0 commit comments