Permalink
Browse files

Moved some basic middleware back to the ewgi_examples project as they…

… are simply not generic enough to include in this project.
  • Loading branch information...
1 parent 0f3d01f commit e089f8f70e43c16cebcd57dbbee492432c4836c4 @davide davide committed Oct 12, 2009
@@ -1,16 +0,0 @@
-%% @author Filippo Pacini <filippo.pacini@gmail.com>
-%% @copyright 2009 S.G. Consulting.
-
-%% @doc Hello world application and to_upper middleware
-
--module(ewgi_hello).
--author('Filippo Pacini <filippo.pacini@gmail.com>').
-
--export([run/2]).
-
-run({ewgi_context, Request, _Response}, []) ->
- ResponseHeaders = [{"Content-type", "text/plain"}],
- Response = {ewgi_response, {200, "OK"}, ResponseHeaders,
- [<<"Hello world!">>], undefined},
- {ewgi_context, Request, Response}.
-
@@ -1,31 +0,0 @@
-%% @author Filippo Pacini <filippo.pacini@gmail.com>
-%% @copyright 2009 S.G. Consulting.
-
-%% @doc Example Index. List of examples with links.
-
--module(ewgi_index).
--author('Filippo Pacini <filippo.pacini@gmail.com>').
-
--export([run/2]).
-
-run({ewgi_context, Request, _Response}, []) ->
- Body = "<html><head><title>Ewgi Examples</title></head>
-<body>
-<h2>Ewgi Examples</h2>
-<ul>
-<li><a href=\"/hello\">Hello World</a>: simple hello world (source file: src/ewgi_hello.erl)</li>
-<li><a href=\"/HELLO\">HELLO WORD</a>: simple middleware transforming all the body in uppercase (source file: src/ewgi_to_upper.erl)</li>
-<li><a href=\"/test.txt\">File streaming</a>: streams the the file priv/www/test.txt (source file: src/ewgi_stream_file.erl)</li>
-<li><a href=\"/gzhello\">Gzip encodes the Hello World example</a>: if the browser accepts gzip encoding the result of the hello_app is gzipped (source file: src/ewgi_deflate.erl)</li>
-<li><a href=\"/postex\">Post example</a>: middleware handling of POST data (source file: src/ewgi_post.erl)</li>
-<li>Session examples (src/ewgi_session.erl):
-<ul><li><a href=\"/session/cookie\">client-side</a>: encrypted client-side session storage using cookies (source file: src/ewgi_session_cookie_store.erl)</li>
-<li><a href=\"/session/server\">server-side</a>: server-side session storage using an ets table (source file: src/ewgi_session_server_store.erl)</li>
-</ul></li>
-</ul>
-</body>
-</html>",
- ResponseHeaders = [{"Content-type", "text/html"}],
- Response = {ewgi_response, {200, "OK"}, ResponseHeaders,
- Body, undefined},
- {ewgi_context, Request, Response}.
@@ -1,14 +0,0 @@
-%% @author Filippo Pacini <filippo.pacini@gmail.com>
-%% @copyright 2009 S.G. Consulting.
-
-%% @doc to_upper middleware
-
--module(ewgi_to_upper).
--author('Filippo Pacini <filippo.pacini@gmail.com>').
-
--export([run/2]).
-
-run(Ctx, []) ->
- Body = ewgi_api:response_message_body(Ctx),
- Body1 = [string:to_upper(erlang:binary_to_list(B)) || B <- Body],
- ewgi_api:response_message_body(Body1, Ctx).

0 comments on commit e089f8f

Please sign in to comment.