aboutsummaryrefslogtreecommitdiff
path: root/apps/dreki_web/src/dreki_web_ui_node.erl
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dreki_web/src/dreki_web_ui_node.erl')
-rw-r--r--apps/dreki_web/src/dreki_web_ui_node.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/dreki_web/src/dreki_web_ui_node.erl b/apps/dreki_web/src/dreki_web_ui_node.erl
new file mode 100644
index 0000000..fdb7c77
--- /dev/null
+++ b/apps/dreki_web/src/dreki_web_ui_node.erl
@@ -0,0 +1,23 @@
+-module(dreki_web_ui_node).
+-behaviour(cowboy_handler).
+-behaviour(cowboy_rest).
+-export([init/2]).
+-export([allowed_methods/2]).
+-export([content_types_accepted/2]).
+-export([content_types_provided/2]).
+
+init(Req, State) ->
+ {cowboy_rest, Req, State}.
+
+allowed_methods(Req, State) ->
+ {[<<"GET">>, <<"HEAD">>, <<"OPTIONS">>, <<"POST">>], Req, State}.
+
+content_types_accepted(Req, State) ->
+ dreki_web:content_types_accepted(Req, State).
+
+content_types_provided(Req, State) ->
+ dreki_web:content_types_provided(Req, State).
+
+to_html(Req, State) ->
+ Html = dreki_web_ui:render(Req, node, []),
+ {Html, Req, State}.