Skip to content

Instantly share code, notes, and snippets.

@heiheshang
Created December 28, 2015 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heiheshang/728cdca1bacfe49ff184 to your computer and use it in GitHub Desktop.
Save heiheshang/728cdca1bacfe49ff184 to your computer and use it in GitHub Desktop.
-module(review).
-behaviour(supervisor).
-behaviour(application).
-export([init/1, start/2, stop/1, main/1]).
-include_lib("kvs/include/user.hrl").
-include_lib("n2o/include/wf.hrl").
-include_lib("kvs/include/metainfo.hrl").
-include_lib("kvs/include/kvs.hrl").
main(A) -> mad:main(A).
start() -> start(normal,[]).
start(_,_) -> supervisor:start_link({local,review},review,[]).
stop(_) -> ok.
-define(USERS, [#user{id="maxim",email="maxim@synrc.com"},
#user{id="doxtop",email="doxtop@synrc.com"},
#user{id="roman",email="roman@github.com"}]).
metainfo() ->
#schema{name=brashik_user,tables=[
#table{name=id_seq,fields=record_info(fields,id_seq),keys=[thing]},
#table{name=login,fields=record_info(fields,post)}
]}.
init([]) -> case cowboy:start_http(http,3,port(),env()) of
{ok, _} -> ok;
{error,_} -> halt(abort,[]) end,
users:init(),
users:populate(?USERS),
kvs:join(),
{ok, {{one_for_one, 5, 10}, []}}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment