Erlang
Web
Scalable & Reliable web framework
ErlLounge, Kraków
Lipiec
2009
(wersja rozszerzona dla czytelników off-line;))
Dziś
Dlaczego?
Kto?
Jak
to działa?
OUT
IN
OUT
{rodzaj, URL pattern, {moduł, funkcja}}.
{dynamic, "^/index.html$", {main, home}}.
{dynamic, delegate, "^/user",
"config/dispatcher/user.conf"}
{static, "^/about$", "about.html"}.
{static, "^style.css$",
enoent}.
OUT
<wpart:list select="map" as=”user_age" list=”all_users">
<p><wpart:lookup key=”user_age" format=”integer"/></p>
</wpart:list>
OUT
config/languages/pl.conf file: {"pass", "Hasło"}.
template: <wpart:lang key="
IN
wpart:fget("post", "form_input"),
wpart:fget("session",
"username"),
wpart:fset("node", node())
And then in your
template: <wpart:lookup key="node"
format="atom"/>
-
automatyczna walidacja
IN
-
Funkcyjne szeregowanie
Annotations
Annotations
-module(my_utils).
-export([logme/4]).
-include_lib("eptic/include/e_
?BEFORE.
logme(AnnArgs, Mod, Fun, ControllerArgs) ->
io:format("~s~n", [AnnArgs]),
{proceed, ControllerArgs}.
-module(controller).
-export([my_fun/0]).
[…]
?LOGME("Calling my_fun").
my_fun() ->
wpart:fget("post", "id"),
[…]
Budowanie
formularzy
Formularze
article.hrl
-record(article, {
id,
text,
hide
}).
-record(article_types, {
id = {integer, […]},
title = {string, […]},
hide = {enum, […]}
}).
templates/article.html
<wpart:form type="article"
action="/article/create" />
Caching
{dynamic, "^/blog/list", {blog, list}, [{cache, persistent]}.
{static, "^/faq$", "doc/faq.html", [{cache, normal}]}.
<wpart:cache id="left_menu"
groups="menus" type="
SOME CONTENT
</wpart:cache>
Cache
- Invalidacja
?INVALIDATE(["^/blog/list"]).
update_blog() ->
[update
your database here...]
{template,
"blog.html"}.
?INVALIDATE_GROUPS(["menus"]).
update_menu() ->
[update
your database here...]
{template,
"blog.html"}.
Distribution
Stress
testing
Stress
testing
Plugins
Przykłady
Przykłady
Przykłady
Przykłady
Przykłady
Zasoby
Pytania
Więcej
->
http://www.erlang-web.org
Dziękuję