Skip to content

[User Scenario] Create APIs with existing database #1921

@dhmlau

Description

@dhmlau

User Scenario

I'd like to create REST APIs with an existing database.

Current Behavior

Steps involved:

  1. Scaffold the app using lb4 app command
  2. Discover schema
    In src/application.ts file, use DataSource.discoverSchemas to discover the mode definitions
  3. Create an empty model with Entity as baseClass, using lb4 model command.
    Copy and paste the json from step 2 in the generated model.ts located in src/models folder.

See details in:
strongloop/v4.loopback.io#50 (comment)
strongloop/v4.loopback.io#50 (comment)

To-dos

  • Document this model discovery path possibly in the "How tos" section in the docs

Potential Enhancement

  • @marioestradarosa suggested to discover the model through the lb4 model command such that:
lb4 model --table mysqlTable --datasource myDS

See his comment for more details.

See also #1949

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIdeveloper-experienceIssues affecting ease of use and overall experience of LB usersstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions