Skip to content

Commit

Permalink
Add validation and visualisation services
Browse files Browse the repository at this point in the history
  • Loading branch information
Riadabd committed Jan 11, 2023
1 parent cac9627 commit 7e6e52f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
24 changes: 14 additions & 10 deletions config/dispatcher/dispatcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/

0 comments on commit 7e6e52f

Please sign in to comment.