-
Notifications
You must be signed in to change notification settings - Fork 25
Project Structure
Sean Kennedy edited this page Jan 26, 2016
·
4 revisions
Here's an example of a typical directory structure.
├── [your_project_name]/
│ ├── index.js <-- optional Main script
│ ├── package.json
| ├── config/
│ │ ├── default.json
│ ├── handlers/
│ ├── services/
│ ├── middleware/
│ ├── swagger/
Here's what happens when you start the BlueOak server for this project:
(In text:
- Load from
config/
, overlaying in this order:
default.json
${NODE_ENV}.json
<stanza-name>.json
- Build dependency tree based on the
init()
functions for modules inhandlers/
,middleware/
andservices/
- Resolve built-in services, e.g.: ‘cache’, ‘config’, ‘logger’, ‘monitor’
- Search for unresolved service dependencies in
node_modules/
-
Call the
init()
functions per the dependency tree -
Load spec definition(s) from
swagger/
-
Initialize the swagger validator with the spec
-
“Wire” the swagger validator to the associated handler (x-handler property in the swagger spec)
-
Expose the swagger API to the network
)