Permalink
Browse files

updated docs and moved blog example here

  • Loading branch information...
1 parent e1be499 commit 397a95b1f7d6e912afcff79acba4074424307c48 @davebryson committed May 14, 2009
View
@@ -2,6 +2,7 @@ all:
(cd src;$(MAKE))
(cd deps/erlydtl/src;$(MAKE))
(cd deps/mochiweb/src;$(MAKE))
+ (cd example/blog;$(MAKE))
docs:
erl -pa `pwd`/ebin \
@@ -12,3 +13,4 @@ clean:
(cd src;$(MAKE) clean)
(cd deps/erlydtl/src;$(MAKE) clean)
(cd deps/mochiweb/src;$(MAKE) clean)
+ (cd example/blog;$(MAKE) clean)
View
@@ -96,4 +96,4 @@ You can also implement the before_filter to check requests before the matching "
called. Filters that pass should simply return the atom ok, otherwise they should return one
of the request responses such as {render...} or {redirect..."
-More to come...
+For more information, see the documention and example blog app included with the source code. And there's a small tutorial on the "Wiki":http://wiki.github.com/davebryson/beepbeep
View
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Module beepbeep</title>
+<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
+</head>
+<body bgcolor="white">
+<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
+<hr>
+
+<h1>Module beepbeep</h1>
+<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>BeepBeep Dispatcher.
+<p>Copyright © Dave Bryson 2008-2009
+ </p>
+
+<p><b>Authors:</b> Dave Bryson [<em>web site:</em> <tt><a href="http://weblog.miceda.org" target="_top">http://weblog.miceda.org</a></tt>].</p>
+
+<h2><a name="description">Description</a></h2><p>BeepBeep Dispatcher</p>
+
+ <p>This is called from the MochiWeb server to dispatch
+requests. Requests are mapped to modules (controllers) and
+functions (actions) based on path components in the Url. For
+example, the request:</p>
+
+ <p>'/feed/show'</p>
+
+ <p>would get mapped to the module (controller) 'feed' and the function
+(action) 'show'.
+By default the root request:</p>
+
+ <p>'/'</p>
+
+ is automatically mapped to the module 'home' and the function 'index'
+ Maps Urls to controllers and their views
+
+<h2><a name="index">Function Index</a></h2>
+<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#dispatch-1">dispatch/1</a></td><td>Dispatches the incoming request to the proper module
+ and function and returns the tuple() from the controller.</td></tr>
+<tr><td valign="top"><a href="#render_template-3">render_template/3</a></td><td>Render the template with the given data.</td></tr>
+</table>
+
+<h2><a name="functions">Function Details</a></h2>
+
+<h3 class="function"><a name="dispatch-1">dispatch/1</a></h3>
+<div class="spec">
+<p><tt>dispatch(Env::<a href="#type-record">record()</a>) -&gt; tuple()</tt></p>
+</div><p>Dispatches the incoming request to the proper module
+ and function and returns the tuple() from the controller.
+ </p>
+
+<h3 class="function"><a name="render_template-3">render_template/3</a></h3>
+<div class="spec">
+<p><tt>render_template(FullPathToFile, ViewFile, Data) -&gt; any()</tt></p>
+</div><p>Render the template with the given data.
+ This is called from YOUR_APP_web.erl automatically.
+ </p>
+<hr>
+
+<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
+<p><i>Generated by EDoc, May 14 2009, 14:08:00.</i></p>
+</body>
+</html>
View
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Module beepbeep_args</title>
+<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
+</head>
+<body bgcolor="white">
+<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
+<hr>
+
+<h1>Module beepbeep_args</h1>
+<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Helper functions for accessing request and session information
+ in your controllers.
+<p>Copyright © Dave Bryson 2008-2009
+ </p>
+
+<p><b>Authors:</b> Dave Bryson [<em>web site:</em> <tt><a href="http://weblog.miceda.org" target="_top">http://weblog.miceda.org</a></tt>].</p>
+
+<h2><a name="description">Description</a></h2>Helper functions for accessing request and session information
+ in your controllers.
+
+<h2><a name="index">Function Index</a></h2>
+<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#content_length-1">content_length/1</a></td><td>Return the content_length.</td></tr>
+<tr><td valign="top"><a href="#content_type-1">content_type/1</a></td><td>Return the content-type.</td></tr>
+<tr><td valign="top"><a href="#get_action-1">get_action/1</a></td><td>Return the current requested action.</td></tr>
+<tr><td valign="top"><a href="#get_all_headers-1">get_all_headers/1</a></td><td>Return all Headers.</td></tr>
+<tr><td valign="top"><a href="#get_all_session_data-1">get_all_session_data/1</a></td><td>Return all session data.</td></tr>
+<tr><td valign="top"><a href="#get_param-2">get_param/2</a></td><td>Return a request Value for a given Key.</td></tr>
+<tr><td valign="top"><a href="#get_session_data-2">get_session_data/2</a></td><td>Get the session data for a given key.</td></tr>
+<tr><td valign="top"><a href="#get_session_id-1">get_session_id/1</a></td><td>Get the current session id.</td></tr>
+<tr><td valign="top"><a href="#method-1">method/1</a></td><td>Return the request method: GET,PUT,POST,DELETE.</td></tr>
+<tr><td valign="top"><a href="#path-1">path/1</a></td><td>Return the Path.</td></tr>
+<tr><td valign="top"><a href="#path_components-1">path_components/1</a></td><td>Return the Path as an array parsed on the "/".</td></tr>
+<tr><td valign="top"><a href="#remote_addr-1">remote_addr/1</a></td><td>Return the Remote address of the client.</td></tr>
+<tr><td valign="top"><a href="#server_name-1">server_name/1</a></td><td>Return the hostname of the server.</td></tr>
+<tr><td valign="top"><a href="#server_port-1">server_port/1</a></td><td>Return the Server port.</td></tr>
+<tr><td valign="top"><a href="#server_protocol-1">server_protocol/1</a></td><td>Return the protocol.</td></tr>
+<tr><td valign="top"><a href="#server_software-1">server_software/1</a></td><td>Return the name of the server.</td></tr>
+<tr><td valign="top"><a href="#set_session_data-3">set_session_data/3</a></td><td>Set a Key,Value in the session.</td></tr>
+</table>
+
+<h2><a name="functions">Function Details</a></h2>
+
+<h3 class="function"><a name="content_length-1">content_length/1</a></h3>
+<div class="spec">
+<p><tt>content_length(Env) -&gt; any()</tt></p>
+</div><p>Return the content_length
+ </p>
+
+<h3 class="function"><a name="content_type-1">content_type/1</a></h3>
+<div class="spec">
+<p><tt>content_type(Env) -&gt; any()</tt></p>
+</div><p>Return the content-type
+ </p>
+
+<h3 class="function"><a name="get_action-1">get_action/1</a></h3>
+<div class="spec">
+<p><tt>get_action(Env) -&gt; any()</tt></p>
+</div><p>Return the current requested action
+ </p>
+
+<h3 class="function"><a name="get_all_headers-1">get_all_headers/1</a></h3>
+<div class="spec">
+<p><tt>get_all_headers(Env) -&gt; any()</tt></p>
+</div><p>Return all Headers
+ </p>
+
+<h3 class="function"><a name="get_all_session_data-1">get_all_session_data/1</a></h3>
+<div class="spec">
+<p><tt>get_all_session_data(Env) -&gt; any()</tt></p>
+</div><p>Return all session data
+ </p>
+
+<h3 class="function"><a name="get_param-2">get_param/2</a></h3>
+<div class="spec">
+<p><tt>get_param(Key, Env) -&gt; any()</tt></p>
+</div><p>Return a request Value for a given Key. This contains information
+ from a form POST OR GET query string
+ </p>
+
+<h3 class="function"><a name="get_session_data-2">get_session_data/2</a></h3>
+<div class="spec">
+<p><tt>get_session_data(Key, Env) -&gt; any()</tt></p>
+</div><p>Get the session data for a given key
+ </p>
+
+<h3 class="function"><a name="get_session_id-1">get_session_id/1</a></h3>
+<div class="spec">
+<p><tt>get_session_id(Env) -&gt; any()</tt></p>
+</div><p>Get the current session id
+ </p>
+
+<h3 class="function"><a name="method-1">method/1</a></h3>
+<div class="spec">
+<p><tt>method(Env) -&gt; any()</tt></p>
+</div><p>Return the request method: GET,PUT,POST,DELETE
+ </p>
+
+<h3 class="function"><a name="path-1">path/1</a></h3>
+<div class="spec">
+<p><tt>path(Env) -&gt; any()</tt></p>
+</div><p>Return the Path
+ </p>
+
+<h3 class="function"><a name="path_components-1">path_components/1</a></h3>
+<div class="spec">
+<p><tt>path_components(Env) -&gt; any()</tt></p>
+</div><p>Return the Path as an array parsed on the "/"
+ </p>
+
+<h3 class="function"><a name="remote_addr-1">remote_addr/1</a></h3>
+<div class="spec">
+<p><tt>remote_addr(Env) -&gt; any()</tt></p>
+</div><p>Return the Remote address of the client
+ </p>
+
+<h3 class="function"><a name="server_name-1">server_name/1</a></h3>
+<div class="spec">
+<p><tt>server_name(Env) -&gt; any()</tt></p>
+</div><p>Return the hostname of the server
+ </p>
+
+<h3 class="function"><a name="server_port-1">server_port/1</a></h3>
+<div class="spec">
+<p><tt>server_port(Env) -&gt; any()</tt></p>
+</div><p>Return the Server port
+ </p>
+
+<h3 class="function"><a name="server_protocol-1">server_protocol/1</a></h3>
+<div class="spec">
+<p><tt>server_protocol(Env) -&gt; any()</tt></p>
+</div><p>Return the protocol
+ </p>
+
+<h3 class="function"><a name="server_software-1">server_software/1</a></h3>
+<div class="spec">
+<p><tt>server_software(Env) -&gt; any()</tt></p>
+</div><p>Return the name of the server
+ </p>
+
+<h3 class="function"><a name="set_session_data-3">set_session_data/3</a></h3>
+<div class="spec">
+<p><tt>set_session_data(Key, Value, Env) -&gt; any()</tt></p>
+</div><p>Set a Key,Value in the session
+ </p>
+<hr>
+
+<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
+<p><i>Generated by EDoc, May 14 2009, 14:08:00.</i></p>
+</body>
+</html>
View
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Module beepbeep_router</title>
+<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
+</head>
+<body bgcolor="white">
+<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
+<hr>
+
+<h1>Module beepbeep_router</h1>
+<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>On start up, this module builds a mapping of the legal Controller
+requests based on the actually files with names ending in '_controller'
+in the src directory.
+<p>Copyright © Dave Bryson 2008-2009
+ </p>
+
+<p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
+<p><b>Authors:</b> Dave Bryson [<em>web site:</em> <tt><a href="http://weblog.miceda.org" target="_top">http://weblog.miceda.org</a></tt>].</p>
+
+<h2><a name="description">Description</a></h2><p>On start up, this module builds a mapping of the legal Controller
+requests based on the actually files with names ending in '_controller'
+in the src directory. For example, if you created two controllers:</p>
+
+ <p>'feed_controller' and 'login_controller'</p>
+
+ <p>the mapping:</p>
+
+ <p>feed -&gt; feed_controller</p>
+
+ <p>login -&gt; login_controller</p>
+
+ is created. This prevents creating an atom() for every incoming
+ request which could lead to a potential DoS attack by filling the global
+ atom() table.
+
+<h2><a name="index">Function Index</a></h2>
+<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#controller_map-0">controller_map/0</a></td><td>Simple helper to view the name-controller mapping.</td></tr>
+<tr><td valign="top"><a href="#get_controller-1">get_controller/1</a></td><td>Given the name of the controller in the URL
+ return the module name in the mapping.</td></tr>
+<tr><td valign="top"><a href="#start-1">start/1</a></td><td>Start the app with the Basedir of the application.</td></tr>
+</table>
+
+<h2><a name="functions">Function Details</a></h2>
+
+<h3 class="function"><a name="controller_map-0">controller_map/0</a></h3>
+<div class="spec">
+<p><tt>controller_map() -&gt; any()</tt></p>
+</div><p>Simple helper to view the name-controller mapping
+ </p>
+
+<h3 class="function"><a name="get_controller-1">get_controller/1</a></h3>
+<div class="spec">
+<p><tt>get_controller(Controller) -&gt; any()</tt></p>
+</div><p>Given the name of the controller in the URL
+ return the module name in the mapping
+ </p>
+
+<h3 class="function"><a name="start-1">start/1</a></h3>
+<div class="spec">
+<p><tt>start(BaseDir) -&gt; any()</tt></p>
+</div><p>Start the app with the Basedir of the application.
+ Basedir is determined in the supervisor
+ </p>
+<hr>
+
+<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
+<p><i>Generated by EDoc, May 14 2009, 14:08:00.</i></p>
+</body>
+</html>
View
@@ -0,0 +1,3 @@
+{application,'BeepBeep'}.
+{packages,[]}.
+{modules,[beepbeep,beepbeep_args,beepbeep_router]}.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>The BeepBeep application</title>
+</head>
+<frameset cols="20%,80%">
+<frame src="modules-frame.html" name="modulesFrame" title="">
+
+<frame src="overview-summary.html" name="overviewFrame" title="">
+<noframes>
+<h2>This page uses frames</h2>
+<p>Your browser does not accept frames.
+<br>You should go to the <a href="overview-summary.html">non-frame version</a> instead.
+</p>
+</noframes>
+</frameset>
+</html>
View
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>The BeepBeep application</title>
+<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
+</head>
+<body bgcolor="white">
+<h2 class="indextitle">Modules</h2>
+<table width="100%" border="0" summary="list of modules">
+<tr><td><a href="beepbeep.html" target="overviewFrame" class="module">beepbeep</a></td></tr>
+<tr><td><a href="beepbeep_args.html" target="overviewFrame" class="module">beepbeep_args</a></td></tr>
+<tr><td><a href="beepbeep_router.html" target="overviewFrame" class="module">beepbeep_router</a></td></tr></table>
+</body>
+</html>
Oops, something went wrong.

0 comments on commit 397a95b

Please sign in to comment.