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 directory | +Description | +How to access in code | +
---|---|---|
Top-level application directory | +||
/node-modules directory |
+ Contains 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.md |
+ Stub file for internal documentation. | +N/A | +
/src directory - Node application files | +||
/controllers directory |
+ A sub-directory for all controller files. See Controller. | +> | +
/datasources directory |
+ A sub-directory for all dataSource files. See DataSource. | +> | +
/models directory |
+ A sub-directory for all model files. See Model. | +> | +
/repositories directory |
+ A sub-directory for all repository files. See Repository. | +> | +
application.ts |
+ Main application program file. A central registry file for inversion of control and dependency injection. See Application. | +N/A | +
index.ts |
+ A script that initializes and runs the application. | +N/A | +
migrate.ts |
+ A script to run database migration. See Database Migrations. | +npm run build && npm run migrate |
+
openapi-spec.ts |
+ A script that exports the OpenAPI spec from the application. | +npm run build && npm run openapi-spec |
+
sequence.ts |
+ A 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.html |
+ An example LoopBack front page. | +N/A | +
Others | +Add your HTML, CSS, client JavaScript files. | ++ |
/common directory - shared application files | +