From 630a8055412bb9622ca202ffb7008d418df78d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 8 Sep 2013 19:08:37 +0200 Subject: Convert the REST pastebin example to a release --- examples/rest_pastebin/src/rest_pastebin.erl | 15 --------------- examples/rest_pastebin/src/toppage_handler.erl | 7 +++---- 2 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 examples/rest_pastebin/src/rest_pastebin.erl (limited to 'examples/rest_pastebin/src') diff --git a/examples/rest_pastebin/src/rest_pastebin.erl b/examples/rest_pastebin/src/rest_pastebin.erl deleted file mode 100644 index e5bd1b5..0000000 --- a/examples/rest_pastebin/src/rest_pastebin.erl +++ /dev/null @@ -1,15 +0,0 @@ -%% Feel free to use, reuse and abuse the code in this file. - --module(rest_pastebin). - -%% API. --export([start/0]). - -%% API. - -start() -> - ok = application:start(crypto), - ok = application:start(cowlib), - ok = application:start(ranch), - ok = application:start(cowboy), - ok = application:start(rest_pastebin). diff --git a/examples/rest_pastebin/src/toppage_handler.erl b/examples/rest_pastebin/src/toppage_handler.erl index 94f08aa..be2b803 100644 --- a/examples/rest_pastebin/src/toppage_handler.erl +++ b/examples/rest_pastebin/src/toppage_handler.erl @@ -3,14 +3,14 @@ %% @doc Pastebin handler. -module(toppage_handler). -%% REST Callbacks +%% Standard callbacks. -export([init/3]). -export([allowed_methods/2]). -export([content_types_provided/2]). -export([content_types_accepted/2]). -export([resource_exists/2]). -%% Callback Callbacks +%% Custom callbacks. -export([create_paste/2]). -export([paste_html/2]). -export([paste_text/2]). @@ -75,8 +75,7 @@ read_file(Name) -> Binary. full_path(Name) -> - {ok, Cwd} = file:get_cwd(), - filename:join([Cwd, "priv", Name]). + filename:join([code:priv_dir(rest_pastebin), Name]). file_exists(Name) -> case file:read_file_info(full_path(Name)) of -- cgit v1.2.3