Skip to content

Application generator should create app with declaratively loaded loopback.rest and explorer #113

Closed

Description

@crandmck

Recent changes (e.g. strongloop/loopback-boot#149 and https://github.com/strongloop/loopback-example-app/pull/77) enable an app to load loopback.rest declaratively in middleware.json and loopback.explorer via component-config.json.
The application generator needs to reflect this.

So by default, the generated middleware.json should have the following to load REST and status middleware:

"routes": {
    "loopback#rest": {
      "paths": ["${restApiRoot}"]
    },
    "loopback#status" : {
      "paths" : ["/"]
    }
  },
...

NOTE: I'm not 100% sure about the status middleware config above. @bajtos can you confirm that is correct?

The above replaces server/boot/rest-api.js and server/boot/root.js which are no longer needed AFAIK.

Also, the generator should create a server/component-config.json that looks like this:

{
  "loopback-explorer": {
    "mountPath": "/explorer"
  }
}

The above replaces server/boot/explorer.js, which is no longer needed AFAIK.

Activity

  1. crandmck commented on Sep 14, 2015

    @crandmck
    ContributorAuthor

    @bajtos suggested that @hacksparrow could handle this fix, but I know Al wants him to focus on the Express generator work. I have assigned to @chandadharap to sort this out.

  2. bajtos commented on Sep 15, 2015

    @bajtos
    Member

    We need to change server/server.js too. The pull request https://github.com/strongloop/loopback-example-app/pull/77 contains all changes we need to make. loopback-example-app should contain exactly the output of slc loopback:example.

  3. hacksparrow commented on Sep 16, 2015

    @hacksparrow
    Member

    An issue in loopback-workspace - strongloop/loopback-workspace#228 - is holding back the update to the generator.

  4. crandmck commented on Sep 16, 2015

    @crandmck
    ContributorAuthor

    Looks like you can workaround that issue...let me know if there are any other questions or issues.

  5. hacksparrow commented on Sep 17, 2015

    @hacksparrow
    Member

    strongloop/loopback-workspace#230 addresses this issue in whole.

    Opened a PR, #114, updating a unit test to ensure the changes introduced by strongloop/loopback-workspace#230 are taken into consideration.

  6. hacksparrow commented on Sep 22, 2015

    @hacksparrow
    Member

    @crandmck @bajtos I think we can close this now, fixed in loopback-workspace@3.18.0.

  7. bajtos commented on Sep 22, 2015

    @bajtos
    Member

    I think we can close this now, fixed in loopback-workspace@3.18.0.

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions