This repository has been archived by the owner on Apr 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Application structure
Ritchie Martori edited this page Apr 8, 2014
·
8 revisions
A full-stack LoopBack application follows the model-view-controller application pattern.
-
Models (LoopBack models) are defined in the application's
/models
directory. -
Views are defined in the application's
/web/views
and/html5/views
directories. -
Controllers are defined in
/html5/controllers
.
A full-stack LoopBack application is laid out in four sub-directories. Each directory is a separate node package.
- The
/api
directory contains code for a "standard LoopBack" app.-
app.api.js
- main app file -
configure.js
- configuration settings, for example hostname and port, database logins, and so on. package.json
-
- The
/models
directory contains "standard LoopBack" model definitions.-
index.js
- Defines each model using the JS files in this directory, for example:exports.Todo = require('./todo');
- One JS file to define each model with
loopback.DataModel.extend()
; for exampletodo.js
. -
package.json
- (Not sure why this is needed here?)
-
- The
/html5
directory contains:-
app.html5.js
- main file -
configure.js
- gulp build file (?) -
package.json
- (Not sure why this is needed here?) -
/controllers
directory-
app.ctrl.js
- main application controller - One
.ctrl.js
file for each model; for example,user.ctrl.js
.
-
-
/views
directory - contains.html
files, including one for each model; for example,user.html
. -
/build
directory - output of build process? Is this gulp output? -
/bower_components
directory contains files that Bower uses to manage dependencies for front-end packages.
-
- The
/web
directory contains: **app.js
- defines routes (what else?) **run.js
- Used to run the application (?) **/views
directory - contains template files, such as .ejs. **package.json
NOTES: For simplicity, I did not include test directories. These can be described in an addendum.
A package consists of the following:
- a package.json
- an entry script or the "main" script of the package
- an optional library of JavaScript code
- a set of tests that cover the contents of the package
- any dependencies the package requires or references to other packages in the dependency field of package.json
- an optional configure.js script
NOTE: this section is still in flux.
- Why are there two views directories:
/web/views
and/html5/views
? What is the diff?