Skip to content

Conversation

@PlasmaPower
Copy link
Contributor

Yet another wrapper implementation. Created this to play with the idea. Requires koajs/compose#53 to work.

@jonathanong
Copy link
Member

what's the pros and cons with #694? seems quite convoluted.

@koajs anyone have opinions on this or #694?

@PlasmaPower
Copy link
Contributor Author

@jonathanong Pros:

  • It will be a lot easier for profilers to generate a tree of middleware
  • Middleware can be converted before any request arrives, speeding things up
  • The onUsed API is more general than just wrapping, and could be used for other things

Cons:

  • The most complicated option

@codecov-io
Copy link

codecov-io commented Apr 28, 2016

Current coverage is 54.27%

Merging #707 into v2.x will decrease coverage by 45.73%

@@               v2.x    #707   diff @@
=======================================
  Files             4       4          
  Lines           414     339    -75   
  Methods          80       0    -80   
  Branches         99      96     -3   
=======================================
- Hits            414     184   -230   
- Misses            0     153   +153   
- Partials          0       2     +2   

Powered by Codecov. Last updated by d47d0f9...72c8318

@PlasmaPower
Copy link
Contributor Author

@jonathanong I added tests for nested middleware, look good?

@PlasmaPower
Copy link
Contributor Author

I've rebased this to v2.x, but actual server tests will still fail until koajs/compose#53 is merged.

@jonathanong jonathanong changed the base branch from v2.x to master February 25, 2017 06:27
@jonathanong
Copy link
Member

would really love more people to express their opinion :)

@miwnwski
Copy link
Contributor

miwnwski commented Jul 2, 2022

I'll just close this as it has little relevance today IMO. Maybe there's still a need for wrappers but I doubt it personally and the same functionality can be approached in user land. Also, over the years I haven't really seen any requests for wrappers. If I remember correctly, this was brought to light due to TJ's original issue to simplify mw profiling, though today this can be solved with async_hooks which seems more like native approach Koa should aim towards. Please reopen if I'm wrong :)

@miwnwski miwnwski closed this Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants