spirit
spirit copied to clipboard
HTTP 2 support
Is there any HTTP 2 support for spirit? Is it possible to implement this with the current middleware API?
Combining resources would be the most important bit for my use-case, since I'm trying to reduce the initial latency of first loading a .js
and then letting that .js
load a .css
. Due to caching issues it's unfortunately not possible to do both at the same time, except by using HTTP 2.
@Lichtjaeger Yes, it might be possible to "hack" a solution that'll work by including ['request']
in every route. However that'd completely remove the main advantages of spirit, namely the easy-to-write unit-tests and the verbose, but precise syntax. Something like return {body, header, push, status}
would be a lot nicer.
~Was looking at http2 support very early on but the module was buggy so I left it.~
~So what you proposed @dodekeract was my initial plan. It'll have to go in the node adapter.~
~The middleware space would be used for higher level support if someone wants to do something more automated or specific to their needs.~
UPDATE: Looks like core http2 support is moving along since I last checked, https://github.com/nodejs/http2 Better to just wait for that. I don't believe too many people actually use the http2 npm package in production.
I'm fine with waiting, since we can (for the moment) just use CloudFlare, which supports HTTP2 by setting some custom headers.
@hnry https://medium.com/@jasnell/say-hello-to-http-2-for-node-js-core-261ba493846e
Anything we can do so far? I think being one of the first HTTP2 frameworks could do wonders for popularity of spirit.