diff --git a/docs/site/Project-layout-reference.md b/docs/site/Project-layout-reference.md new file mode 100644 index 000000000000..31c338b87249 --- /dev/null +++ b/docs/site/Project-layout-reference.md @@ -0,0 +1,118 @@ +--- +lang: en +title: 'Project Layout Reference' +keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript +sidebar: lb4_sidebar +permalink: /doc/en/lb4/Project-layout-reference.html +--- + +LoopBack 4 project files and directories are in the _application root +directory_. Within this directory the standard LoopBack project structure has +these sub-directories: + +- `src` - Node application scripts and configuration files. +- `public` - Client JavaScript, HTML, and CSS files. +- `definitions` - API and product definition YAML files (**IBM API Connect + only**). + +{% include tip.html content="By LoopBack naming conventions, artifacts such as models are grouped under their sub-directories. Also, with LoopBack artifact generators, they create class names in CamelCase and file names are in snake-case. For example, if you create a model named `MyUserModel` with the model generator, it creates files `my-user.model.ts` under `src/models`. See [Naming Convention](Command-line-interface.md#naming-convention) for more information. +" %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File or directoryDescriptionHow to access in code
Top-level application directory
/node-modules directoryContains Node packages as specified as dependencies in package.json. Update with npm install.N/A
+ package.json + + Standard npm package specification. Use it to set up package dependencies, among other things. This file must be in the application root directory. See npm-package.json for information.. + N/A
README.mdStub file for internal documentation.N/A
/src directory - Node application files
/controllers directoryA sub-directory for all controller files. See Controller.
/datasources directoryA sub-directory for all dataSource files. See DataSource.
/models directoryA sub-directory for all model files. See Model.
/repositories directoryA sub-directory for all repository files. See Repository.
application.tsMain application program file. A central registry file for inversion of control and dependency injection. See Application.N/A
index.tsA script that initializes and runs the application.N/A
migrate.tsA script to run database migration. See Database Migrations.npm run build && npm run migrate
openapi-spec.tsA script that exports the OpenAPI spec from the application.npm run build && npm run openapi-spec
sequence.tsA file where to define a series of steps to control how a specific type of `Server` + responds to incoming requests. See Sequence.N/A
/public directory - Client application files
index.htmlAn example LoopBack front page.N/A
OthersAdd your HTML, CSS, client JavaScript files. 
/common directory - shared application files
diff --git a/docs/site/sidebars/lb4_sidebar.yml b/docs/site/sidebars/lb4_sidebar.yml index 9166f7024e73..95d711b7681b 100644 --- a/docs/site/sidebars/lb4_sidebar.yml +++ b/docs/site/sidebars/lb4_sidebar.yml @@ -604,6 +604,10 @@ children: output: 'web, pdf' children: + - title: 'Project Layout Reference' + url: Project-layout-reference.html + output: 'web, pdf' + - title: 'Examples' url: Examples.html output: 'web, pdf'