[
https://issues.apache.org/jira/browse/THRIFT-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew de Andrade updated THRIFT-2978:
--------------------------------------
Attachment: 0001-Dependency-map-and-web-server-middleware-refactor.patch
So this is my first stab at trying to refactor the web_server and make the XHR
and websocket middlewares available for mounting in a different webserver (like
an express/connect app).
I tried to replace the processGet code with a well implemented static file
serving middleware, https://github.com/expressjs/serve-static . However when I
did so, I found that the dependency tree was so intertwined using dot-notation
namespacing via lib/index.js and lib/thrift.js that I needed to unravel it so
that serve-static was not included in the browserify bundle. The patch also
contains the efforts of that refactoring. However I hit a brick wall in that
completing this refactor is going to require refactoring the javascript
compiler code as well so that it doesn't require('thrift') as an entry point
and instead requires another file with the bare minimum dependencies needed.
This patch and the future patch refactoring the compiler are necessary to
address the needs in THRIFT-2995
> nodejs: extract middleware module from http server
> --------------------------------------------------
>
> Key: THRIFT-2978
> URL: https://issues.apache.org/jira/browse/THRIFT-2978
> Project: Thrift
> Issue Type: Improvement
> Components: Node.js - Library
> Reporter: Andrew de Andrade
> Priority: Minor
> Attachments:
> 0001-Dependency-map-and-web-server-middleware-refactor.patch
>
>
> Currently the http-server in lib/nodejs is an all-in-one solution, including
> features likes:
> - CORS verification
> - static asset serving
> The meat and potatoes of http-server relevant to thrift is the listener at a
> certain path that knows how to handle thrift XHR POST requests or how to
> upgrade a thrift websocket connection. This part should be extracted out as a
> middleware for use with any webserver solution such as the core http and
> https modules or frameworks like Express and Hapi.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)