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

Mount Express router with OpenAPI spec #2389

Closed
bajtos opened this Issue Feb 14, 2019 · 0 comments

Comments

Projects
None yet
3 participants
@bajtos
Copy link
Member

bajtos commented Feb 14, 2019

This is a follow-up for the spike #2318, see the discussion and PoC code for more context.

Implement app.mountExpressRouter(basePath, router, spec?) to allow LB4 app developers to add arbitrary set of Express routes and provide OpenAPI spec

mountExpressRouter(
  basePath: string,
  router: ExpressRequestHandler,
  spec?: RouterSpec,
): void;

The new API should build on the foundation laid down by StaticAssetsRoute and allows LB4 app
developers to add arbitrary set of Express routes and provide OpenAPI spec.

As a result, LB4 will have the following request-handling pipeline:

  1. Request-preprocessing middleware like CORS, this is not customizable yet.
  2. Native LoopBack 4 routes (controller methods or route handlers).
  3. External Express routers (if the request was not handled yet).
  4. Static assets (if the request was not handled yet).

Related issues: #1849

Acceptance criteria

  • Refactor StaticAssetsRoute into ExternalExpressRoutes and ExternalRoute, see PoC in external-express-routes.ts --> #2524
  • Add mountExpressRouter to both RestServer and RestApplication classes.
  • Update API docs
  • Describe the new API in Routes, include a simple example based on express.Router (not LB3).

@dhmlau dhmlau added this to the March 2019 milestone milestone Mar 1, 2019

@dhmlau dhmlau referenced this issue Mar 4, 2019

Closed

Monthly Milestone - March 2019 ☀️🚗💐 #2516

18 of 34 tasks complete

@bajtos bajtos self-assigned this Mar 4, 2019

@bajtos bajtos removed their assignment Mar 5, 2019

@nabdelgadir nabdelgadir referenced this issue Mar 27, 2019

Merged

feat(rest): add mountExpressRouter #2643

5 of 7 tasks complete

@dhmlau dhmlau referenced this issue Apr 1, 2019

Open

Monthly Milestone - April 2019 🌿🐰☔️ #2669

11 of 46 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.