Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Review and modify content in Controllers page #2099

Closed
2 tasks done
dhmlau opened this issue Nov 30, 2018 · 4 comments
Closed
2 tasks done

[Docs] Review and modify content in Controllers page #2099

dhmlau opened this issue Nov 30, 2018 · 4 comments

Comments

@dhmlau
Copy link
Member

dhmlau commented Nov 30, 2018

Description / Steps to reproduce / Feature proposal

Originated from the docs cleanup epic: #1908

Under Key Concepts > Controller page, there is a section of "Review Questions" which seem to be notes reminding what to add / modify in the future. We should clean it up.

Review questions

  • Simplest possible example of a Controller

    • app.controller()
    • a few methods
    • no usage of @api
  • How to create a basic Controller (beyond the hello world)

    • Using DI (@Inject)
    • Using decorators (eg. @authenticate)
    • Defining routes via sugar annoations (@get, @post)
    • Errors
    • Using async / await and Promises

Acceptance Criteria

  • Review the review questions section of the Controllers page
  • for items that are applicable, add / remove / update content accordingly.
@jannyHou
Copy link
Contributor

jannyHou commented Dec 4, 2018

Document the flow of creating a controller from running lb4 controller, incrementally add pieces of the rest apis

  • run lb4 controller to create the controller class
  • create business function
  • decorate it with rest decorators
  • inject services
  • boot script will automatically load the controller
    • For app.controller(), if you want to customize the controller registration, it would be the api you can call.

Start with the simplest use case(create a controller by cli), then introduce customization approaches when the scenario turns to be more complicated.

@jannyHou
Copy link
Contributor

jannyHou commented Dec 4, 2018

Stretch goal:

  • We could visualize the controller concept (an example would be the nestjs doc) in a diagram.

@dhmlau dhmlau added p2 and removed TOB labels Feb 11, 2019
@dhmlau
Copy link
Member Author

dhmlau commented Feb 12, 2019

Adding the Review questions from https://loopback.io/doc/en/lb4/Controllers.html#review-questions:

  • Simplest possible example of a Controller

    • app.controller()
    • a few methods
    • no usage of @api
  • How to create a basic Controller (beyond the hello world)

    • Using DI (@Inject)
    • Using decorators (eg. @authenticate)
    • Defining routes via sugar annoations (@get, @post)
    • Errors
    • Using async / await and Promises

@nabdelgadir
Copy link
Contributor

Review questions were removed as part of #2376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants