Example showing how to use the Raw Router to delegate an http request to any arbitrary Wick Component.
This app configuration starts off with the common Application
kind and a name field.
kind: wick/app@v1 name: serve_http_component
Note: All HTTP routers must be configured with a
paththat acts as a simple filter to determine which router to execute. Routers are executed in top-down order. A router configured with
path: "/"will match all traffic so should be defined at the end of the router configuration.
routers: - codec: Json kind: wick/router/raw@v1 operation: test_component::http_handler path: /
Operations can be defined inline or referenced by name from a previously imported component. The
operation value above comes from a previously imported
import: - component: kind: wick/component/manifest@v1 ref: ../../crates/integration/test-http-trigger-component/component.yaml name: test_component
git clone https://github.com/candlecorp/wick && cd wick wick run examples/http/raw-router.wick
Note: Examples may require environment variables and execution from within the wick project’s root to access any local files.
The full example configuration is included below,
--- kind: wick/app@v1 name: serve_http_component metadata: description: Example showing how to use the Raw Router to delegate an http request to any arbitrary Wick Component. version: 0.0.1 authors: - 'Wick Maintainers' vendors: - 'Candle Corporation' licenses: - Apache-2.0 resources: - name: http resource: kind: wick/resource/tcpport@v1 port: '8999' address: 0.0.0.0 import: - name: test_component component: kind: wick/component/manifest@v1 ref: ../../crates/integration/test-http-trigger-component/component.yaml triggers: - kind: wick/trigger/http@v1 resource: http routers: - kind: wick/router/raw@v1 path: / codec: Json operation: test_component::http_handler