lytlang/test/fixtures/example_projects/simple_app/app.lyt

29 lines
567 B
Text
Raw Normal View History

2019-11-15 00:51:27 -06:00
!project SimpleApp simple_app
# should generate a SimpleApp.MixProject_ module
version: "0.1.0"
elixir: "~> 1.8"
lytl: "~> 0.1"
start_permanent: Mix.env() == prod
extra_applications: [logger]
deps: []
2019-06-16 00:36:12 -05:00
2019-11-15 00:51:27 -06:00
!module
# uses project's name as module if not module name specified
import Plug.Conn
2019-06-16 00:36:12 -05:00
2019-11-15 00:51:27 -06:00
init = opts -> IO.puts "initializing plug"; opts
2019-06-16 00:36:12 -05:00
2019-11-15 00:51:27 -06:00
call = conn _options = [] ->
2019-06-16 00:36:12 -05:00
IO.puts "calling plug"
conn
|> put_resp_content_type "text/plain"
|> send_resp 200 "Hello world"
2019-11-15 00:51:27 -06:00
long_fn =
arg1
arg2
arg3
->
2019-06-16 00:36:12 -05:00
# in lytx run `Plug.Adapters.Cowboy.http SimpleApp []`