mirror of
https://github.com/strapi/strapi.git
synced 2025-08-27 18:25:49 +00:00
Add documentation
This commit is contained in:
parent
ac95603a12
commit
d9f1f39ee4
@ -83,9 +83,36 @@ The `bootstrap` function is called at every server start. You can use it to add
|
||||
|
||||
Here are some use cases:
|
||||
|
||||
- Create an admin user if there isn't.
|
||||
- Create an admin user if there isn't one.
|
||||
- Fill the database with some necessary data.
|
||||
- Check that the database is up-and-running.
|
||||
- Load some envrionments variables.
|
||||
|
||||
The bootstrap function can be synchronous or asynchronous
|
||||
|
||||
**Synchronous**
|
||||
|
||||
```js
|
||||
module.exports = () => {
|
||||
// some sync code
|
||||
};
|
||||
```
|
||||
|
||||
**Return a promise**
|
||||
|
||||
```js
|
||||
module.exports = () => {
|
||||
return new Promise(/* some code */);
|
||||
};
|
||||
```
|
||||
|
||||
**Be async**
|
||||
|
||||
```js
|
||||
module.exports = async () => {
|
||||
await someSetup();
|
||||
};
|
||||
```
|
||||
|
||||
### CRON tasks
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*
|
||||
* See more details here: https://strapi.io/documentation/3.0.0-beta.x/configurations/configurations.html#bootstrap
|
||||
*/
|
||||
|
||||
module.exports = () => {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user