-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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)
- Loading branch information
Showing
21 changed files
with
493 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Parse Server 6 Migration Guide <!-- omit in toc --> | ||
|
||
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). | ||
|
||
--- | ||
|
||
- [Import Statement](#import-statement) | ||
- [Asynchronous Initialization](#asynchronous-initialization) | ||
|
||
--- | ||
|
||
## Import Statement | ||
|
||
The import and initialization syntax has been simplified with more intuitive naming and structure. | ||
|
||
*Parse Server 5:* | ||
```js | ||
// Returns a Parse Server instance | ||
const ParseServer = require('parse-server'); | ||
|
||
// Returns a Parse Server express middleware | ||
const { ParseServer } = require('parse-server'); | ||
``` | ||
|
||
*Parse Server 6:* | ||
```js | ||
// Both return a Parse Server instance | ||
const ParseServer = require('parse-server'); | ||
const { ParseServer } = require('parse-server'); | ||
``` | ||
|
||
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. | ||
|
||
## Asynchronous Initialization | ||
|
||
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. | ||
|
||
*Parse Server 5:* | ||
```js | ||
// 1. Import Parse Server | ||
const { ParseServer } = require('parse-server'); | ||
|
||
// 2. Create a Parse Server instance as express middleware | ||
const server = new ParseServer(config); | ||
|
||
// 3. Mount express middleware | ||
app.use("/parse", server); | ||
``` | ||
|
||
*Parse Server 6:* | ||
```js | ||
// 1. Import Parse Server | ||
const ParseServer = require('parse-server'); | ||
|
||
// 2. Create a Parse Server instance | ||
const server = new ParseServer(config); | ||
|
||
// 3. Start up Parse Server asynchronously | ||
await server.start(); | ||
|
||
// 4. Mount express middleware | ||
app.use("/parse", server.app); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.