mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Convert the REST pastebin example to a release
This commit is contained in:
parent
dacaf5d293
commit
630a805541
7 changed files with 55 additions and 56 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue