HTTP Router #1866
rohiievych
started this conversation in
Ideas
HTTP Router
#1866
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the problem
Impress is a good option for new projects that work over WebSocket RPC communication. But this approach cannot facilitate transferring of those projects, where the whole client-server communication is bound on HTTP REST or REST over HTTP APIs. That's why we need a full-featured HTTP router, which let enterprises perform a soft project transition with existing HTTP APIs. The solution should include a convenient way of using all HTTP features like headers or url params and search (query) params.
Describe the solution
Here is an example of desired HTTP routing declaration:
The object describes HTTP features to be used: a verb (e.g.
GET
,POST
) with route including url params (e.g.:categoryId
), args with data extracted from HTTP request and the interface method to be called with those args, which are used for RPC by default.Implementation details:
customHeader: { type: 'header', key: 'x-custom-header' }
.2.1. HTTP data source types description:
param
- url param like:categoryId
;header
- HTTP header likehost: example.com
;query
- url search param like?id=123456
;body
- HTTP request body like{ user: { name: 'Peter' } }
or astream
in case of binary uploading.args
, we can simply put it as a route value.Alternatives
Currently we can use RPC over HTTP in Impress, but we cannot extract data from url params or headers. In more advanced case we can implement a custom router, but it requires a lot of code related to parsing of HTTP requests.
Additional context
Additionally, this router can be used for browser page routing, which is also very important feature.
Beta Was this translation helpful? Give feedback.
All reactions