@@ -37,6 +37,10 @@ starterKit.init({
37
37
database: {
38
38
name: ' mainDb' // Database instance name within Hapi. /!\ Different from the actual database name
39
39
syncForce: true , // Whether to reload the models each time the server restarts.
40
+ modelPaths: [ // An array of path from where to load the Sequelize Models.
41
+ ' lib/**/model.js' , // Default to ['lib/**/model.js', 'lib/**/models/*.js']
42
+ ' lib/**/models/*.js'
43
+ ],
40
44
credentials: {
41
45
dbName: ' myproject_db' // Database name
42
46
user: ' root' , // User that will access the database
@@ -58,9 +62,26 @@ starterKit.start([
58
62
], loadFixtures).then (() => {
59
63
// Do your thing !
60
64
});
65
+
66
+ // As init() returns an instance of itself, we can chain the calls:
67
+ starterKit .init (config)
68
+ .start (plugins, loadFixtures)
69
+ .then (() => {
70
+ // ...
71
+ });
61
72
```
62
73
** For the Database config, please report to the Sequelize 3 documentation as this package is using Sequelize as well as Hapi-Sequelize.**
63
74
75
+ ## The StarterKit object
76
+ ### Properties
77
+ - starterKit.config: The loaded configuration.
78
+ - starterKit.server: The Hapi server instanciated by the call to ` init() ` .
79
+ - starterKit.sequelize: The Sequelize instance instanciated by the call to ` init() ` .
80
+ - starterKit.initialized: A boolean specifying whether the object was initialized (i.e ` init() ` was called).
81
+ ### Methods
82
+ - init(config): returns an instance of the starterKit.
83
+ - start(plugins, loadFixtures): returns a Promise resolved after the plugins registration, the model loading and optionaly the fixtures loading.
84
+
64
85
## Documentation for .start()
65
86
The start function is used to:
66
87
- register Hapi plugins
0 commit comments