我在这里是因为我试图在 YAWS 上使用 Couchbeam 表单。我已经测试了 CB,它在终端上正常工作,使用:
erl -pa ebin -pa deps/ibrowse/ebin -s couchbeam
现在我正在尝试在我的网页上复制我在本地所做的事情。我相信问题是我不知道如何告诉 erl 从 yaws 页面执行 'erl -pa ebin -pa deps/ibrowse/ebin -s couchbeam'。
我试图简单地运行所有需要的应用程序,但我得到了这个:
Stack: [{ibrowse_lib,url_encode,["test"],[]},
{couchbeam,save_doc,3,[{file,"src/couchbeam.erl"},{line,383}]},
{m50,out,1,
[{file,"/Users/Nesh/.yaws/yaws/default/m50.erl"},{line,35}]},
{yaws_server,deliver_dyn_part,8,
[{file,"yaws_server.erl"},{line,2647}]},
{yaws_server,aloop,4,[{file,"yaws_server.erl"},{line,1152}]},
{yaws_server,acceptor0,2,[{file,"yaws_server.erl"},{line,1013}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]
这是我的erl代码:
<erl>
startApp() ->
application:start(crypto),
application:start(private_key),
application:start(ssl),
application:start(sasl),
application:start(ibrowse),
application:start(couchbeam).
out(Arg) ->
startApp(),
Host = "localhost",
Port = 5984,
Prefix = "",
Options = [],
S = couchbeam:server_connection(Host, Port, Prefix, Options),
Options = [],{ok, Db} = couchbeam:open_db(S, "erlang", Options),
Doc = {[{<<"_id">>, <<"test">>},{<<"content">>, <<"web text">>}]},
{ok, Doc1} = couchbeam:save_doc(Db, Doc).
</erl>