From 7c7a95b59bd320583f681de0d6d3ed2c69958749 Mon Sep 17 00:00:00 2001 From: Agnes Lin Date: Wed, 19 Aug 2020 16:34:16 -0400 Subject: [PATCH] docs: add project layout ref page Signed-off-by: Agnes Lin --- docs/site/Project-layout-reference.md | 123 ++++++++++++++++++++++++++ docs/site/sidebars/lb4_sidebar.yml | 4 + 2 files changed, 127 insertions(+) create mode 100644 docs/site/Project-layout-reference.md diff --git a/docs/site/Project-layout-reference.md b/docs/site/Project-layout-reference.md new file mode 100644 index 000000000000..33465364dad4 --- /dev/null +++ b/docs/site/Project-layout-reference.md @@ -0,0 +1,123 @@ +--- +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 4 project structure has +these sub-directories: + +- `src` - TypeScript source code and configuration files. +- `public` - Client side assets (JavaScript, HTML, and CSS files) for the home + page. + +{% 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. +" %} + +The following table uses files in the +[`Todo` example](https://github.com/strongloop/loopback-next/tree/master/examples/todo) +as code references. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File or directoryDescriptionHow to access in code
Top-level application directory
dist/ directoryContains transpiled JavaScript code generated by npm run build.npm run build
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
tsconfig.json + A file specifies the root files and the compiler options required to compile the project. See tsconfig.json for information.. + 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. 
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'