Skip to content

Instantly share code, notes, and snippets.

@JakubMifek
Created January 21, 2019 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakubMifek/6577915df235d3ff26ee6ccb516b21fc to your computer and use it in GitHub Desktop.
Save JakubMifek/6577915df235d3ff26ee6ccb516b21fc to your computer and use it in GitHub Desktop.
jakub@Marvn:~/Projects$ lb4 project
? Project description: project
? Project root directory: project
? Application class name: ProjectApplication
? Select features to enable in the project Enable tslint, Enable prettier, Enable moch
a, Enable loopbackBuild, Enable vscode, Enable repositories, Enable services
create .npmrc
create .prettierignore
create .prettierrc
create DEVELOPING.md
create README.md
create index.ts
create package.json
create tsconfig.json
create tslint.build.json
create tslint.json
create .vscode/settings.json
create .vscode/tasks.json
create test/mocha.opts
create .gitignore
create index.js
create public/index.html
create src/application.ts
create src/index.ts
create src/sequence.ts
create test/README.md
create src/controllers/README.md
create src/controllers/index.ts
create src/controllers/ping.controller.ts
create src/datasources/README.md
create src/models/README.md
create src/repositories/README.md
create test/acceptance/home-page.acceptance.ts
create test/acceptance/ping.controller.acceptance.ts
create test/acceptance/test-helper.ts
npm WARN deprecated text-encoding@0.6.4: no longer maintained
npm WARN project@1.0.0 No license field.
added 543 packages from 1379 contributors and audited 3244 packages in 159.195s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
╭───────────────────────────────────────────────────────────────╮
│ │
│ New minor version of npm available! 6.4.1 → 6.6.0 │
│ Changelog: https://github.com/npm/cli/releases/tag/v6.6.0 │
│ Run npm install -g npm to update! │
│ │
╰───────────────────────────────────────────────────────────────╯
Application project was created in project.
Next steps:
$ cd project
$ npm start
jakub@Marvn:~/Projects$ ll
total 12
drwxrwxr-x 3 jakub jakub 4096 led 21 12:29 .
drwxr-xr-x 25 jakub jakub 4096 led 21 12:27 ..
drwxrwxr-x 7 jakub jakub 4096 led 21 12:30 project
jakub@Marvn:~/Projects$ cd project/
jakub@Marvn:~/Projects/project$ ll
total 88
drwxrwxr-x 7 jakub jakub 4096 led 21 12:30 .
drwxrwxr-x 3 jakub jakub 4096 led 21 12:29 ..
-rw-rw-r-- 1 jakub jakub 1421 led 21 12:29 DEVELOPING.md
-rw-rw-r-- 1 jakub jakub 967 led 21 12:29 .gitignore
-rw-rw-r-- 1 jakub jakub 518 led 21 12:29 index.js
-rw-rw-r-- 1 jakub jakub 23 led 21 12:29 index.ts
drwxrwxr-x 284 jakub jakub 12288 led 21 12:32 node_modules
-rw-rw-r-- 1 jakub jakub 19 led 21 12:29 .npmrc
-rw-rw-r-- 1 jakub jakub 1669 led 21 12:29 package.json
-rw-rw-r-- 1 jakub jakub 12 led 21 12:29 .prettierignore
-rw-rw-r-- 1 jakub jakub 99 led 21 12:29 .prettierrc
drwxrwxr-x 2 jakub jakub 4096 led 21 12:29 public
-rw-rw-r-- 1 jakub jakub 167 led 21 12:29 README.md
drwxrwxr-x 6 jakub jakub 4096 led 21 12:29 src
drwxrwxr-x 3 jakub jakub 4096 led 21 12:29 test
-rw-rw-r-- 1 jakub jakub 282 led 21 12:29 tsconfig.json
-rw-rw-r-- 1 jakub jakub 128 led 21 12:29 tslint.build.json
-rw-rw-r-- 1 jakub jakub 129 led 21 12:29 tslint.json
drwxrwxr-x 2 jakub jakub 4096 led 21 12:29 .vscode
-rw-rw-r-- 1 jakub jakub 3 led 21 12:29 .yo-rc.json
jakub@Marvn:~/Projects/project$ lb4 model
? Model class name: A
? Please select the model base class Entity
Let's add a property to A
Enter an empty property name when done
? Enter the property name: _id
? Property type: string
? Is _id the ID property? Yes
? Is it required?: Yes
? Default value [leave blank for none]:
Let's add another property to A
Enter an empty property name when done
? Enter the property name: _t
? Property type: string
? Is it required?: Yes
? Default value [leave blank for none]:
Let's add another property to A
Enter an empty property name when done
? Enter the property name:
create src/models/a.model.ts
update src/models/index.ts
Model A was created in src/models/
jakub@Marvn:~/Projects/project$ lb4 model
? Model class name: B
? Please select the model base class A
Let's add a property to B
Enter an empty property name when done
? Enter the property name: data
? Property type: string
? Is data the ID property? No
? Is it required?: Yes
? Default value [leave blank for none]: sample data
Let's add another property to B
Enter an empty property name when done
? Enter the property name:
create src/models/b.model.ts
update src/models/index.ts
Model B was created in src/models/
jakub@Marvn:~/Projects/project$ lb4 datasource
? Datasource name: memory
? Select the connector for memory: In-memory db (supported by StrongLoop)
? window.localStorage key to use for persistence (browser only):
? Full path to file for persistence (server only):
create src/datasources/memory.datasource.json
create src/datasources/memory.datasource.ts
npm WARN project@1.0.0 No license field.
+ memory@0.0.3
added 1 package from 1 contributor and audited 3245 packages in 13.419s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
update src/datasources/index.ts
Datasource memory was created in src/datasources/
jakub@Marvn:~/Projects/project$ lb4 repository
? Please select the datasource MemoryDatasource
? Select the model(s) you want to generate a repository A
create src/repositories/a.repository.ts
update src/repositories/index.ts
Repository A was created in src/repositories/
jakub@Marvn:~/Projects/project$ lb4 controller
? Controller class name: A
? What kind of controller would you like to generate? REST Controller with CRUD functions
? What is the name of the model to use with this CRUD repository? B
? What is the name of your CRUD repository? ARepository
? What is the type of your ID? string
? What is the base HTTP path name of the CRUD operations? /bs
create src/controllers/a.controller.ts
update src/controllers/index.ts
Controller A was created in src/controllers/
jakub@Marvn:~/Projects/project$ vim src/controllers/a.controller.ts
jakub@Marvn:~/Projects/project$ lb4 controller
? Controller class name: B
? What kind of controller would you like to generate? REST Controller with CRUD functions
? What is the name of the model to use with this CRUD repository? B
? What is the name of your CRUD repository? ARepository
? What is the type of your ID? string
? What is the base HTTP path name of the CRUD operations? /bs
create src/controllers/b.controller.ts
update src/controllers/index.ts
Controller B was created in src/controllers/
jakub@Marvn:~/Projects/project$ vim src/controllers/b.controller.ts
jakub@Marvn:~/Projects/project$ vim src/models/a.model.ts
jakub@Marvn:~/Projects/project$ vim src/models/a.model.ts
jakub@Marvn:~/Projects/project$ npm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment