Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WIP making the mochi template do node stuff to.

  • Loading branch information...
commit b23340dc268b6fe5d0177ee9bcd38d48562f5c51 1 parent 075e4bf
@russelldb authored
View
1  templates/index.html
@@ -0,0 +1 @@
+It worked!!!
View
2  templates/mochi.app
@@ -9,6 +9,6 @@
{{appid}}_deps
]},
{registered, []},
- {mod, {{{appid}}_app, []}},
+ {mod, { {{appid}}_app, []}},
{env, []},
{applications, [kernel, stdlib, crypto]}]}.
View
1  templates/mochi.app.config
@@ -0,0 +1 @@
+[{ {{appid}}, [{bind_address, 127.0.0.1}, {port, 8000}, {server_name, "{{appid}}" }, {document_root, "{{document_root}}"}}].
View
4 templates/mochi.template
@@ -1,4 +1,4 @@
-{variables, [{appid, "myapp"}]}.
+{variables, [{appid, "myapp"}, {document_root, "rel/overlay/site/www"}]}.
{template, "mochi.app", "apps/{{appid}}/ebin/{{appid}}.app"}.
{template, "mochi_app.erl", "apps/{{appid}}/src/{{appid}}_app.erl"}.
{template, "mochi_sup.erl", "apps/{{appid}}/src/{{appid}}_sup.erl"}.
@@ -6,3 +6,5 @@
{template, "mochi_web.erl", "apps/{{appid}}/src/{{appid}}_web.erl"}.
{template, "mochi.erl", "apps/{{appid}}/src/{{appid}}.erl"}.
{template, "mochi.rebar.config", "rebar.config"}.
+{template, "mochi.app.config", "app.config"}.
+{template, "index.html", "{{document_root}}/index.html"}.
View
7 templates/mochi_sup.erl
@@ -41,13 +41,8 @@ upgrade() ->
%% @spec init([]) -> SupervisorTree
%% @doc supervisor callback.
init([]) ->
- Ip = case os:getenv("MOCHIWEB_IP") of false -> "0.0.0.0"; Any -> Any end,
- WebConfig = [
- {ip, Ip},
- {port, 8000},
- {docroot, {{appid}}_deps:local_path(["priv", "www"])}],
Web = { {{appid}}_web,
- { {{appid}}_web, start, [WebConfig]},
+ { {{appid}}_web, start, []},
permanent, 5000, worker, dynamic},
Processes = [Web],
View
4 templates/mochi_web.erl
@@ -6,11 +6,11 @@
-module({{appid}}_web).
-author('author <author@example.com>').
--export([start/1, stop/0, loop/2]).
+-export([start/0, stop/0, loop/2]).
%% External API
-start(Options) ->
+start() ->
{DocRoot, Options1} = get_option(docroot, Options),
Loop = fun (Req) ->
?MODULE:loop(Req, DocRoot)
Please sign in to comment.
Something went wrong with that request. Please try again.