diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index 54d0a26..20dfc0f 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -2,22 +2,26 @@ defmodule Dispatcher do use Matcher define_accept_types [ html: [ "text/html", "application/xhtml+html" ], - json: [ "application/json", "application/vnd.api+json" ] + json: [ "application/json", "application/vnd.api+json" ], + image: [ "image/png" ] ] @any %{} @json %{ accept: %{ json: true } } @html %{ accept: %{ html: true } } + @image %{ accept: ${ image: true } } - # In order to forward the 'themes' resource to the - # resource service, use the following forward rule: - # - # match "/themes/*path", @json do - # Proxy.forward conn, path, "http://resource/themes/" - # end - # - # Run `docker-compose restart dispatcher` after updating - # this file. + match "/validate/*path", @json do + Proxy.forward conn, path, "http://validator/validate" + end + + match "/hello/*path", @json do + Proxy.forward conn, path, "http://visualiser/hello" + end + + match "/graph/*path", @image do + Proxy.forward conn, path, "http://visualiser/graph" + end match "/*_", %{ last_call: true } do send_resp( conn, 404, "Route not found. See config/dispatcher.ex" ) diff --git a/docker-compose.yml b/docker-compose.yml index e0ee45c..826d8e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,3 +31,19 @@ services: - database:database volumes: - ./config/resources:/config + validator: + image: semtech/mu-javascript-template + ports: + - 9229:9229 + environment: + NODE_ENV: "development" + links: + - database:database + volumes: + - /home/r2d2/Code/rpio/semtech/app-turtle-validator:/app/ + visualiser: + build: /home/r2d2/Code/rpio/semtech/app-turtle-visualiser/ + environment: + MODE: "development" + volumes: + - /home/r2d2/Code/rpio/semtech/app-turtle-visualiser:/app/ \ No newline at end of file