Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update dynamo, public directory sample

  • Loading branch information...
commit 816d7fab1cd46a7800b6bf5ed2225f22af62b599 1 parent 39f2e1c
@goshakkk authored
View
2  Procfile
@@ -1 +1 @@
-web: elixir --no-halt -S mix run "DynamoDemo.start"
+web: mix server -p=$PORT
View
1  README.md
@@ -11,6 +11,7 @@ It is an example of simple Dynamo application, which:
* sets custom status code
* sends files
* generates JSON using [exjson](https://github.com/guedes/exjson)
+* serves content from the "public" directory at `/public`
## Live app
View
3  lib/dynamo_demo/app.ex → app/routers/application_router.ex
@@ -1,6 +1,5 @@
-defmodule DynamoDemo.App do
+defmodule ApplicationRouter do
use Dynamo.Router
- use Dynamo.App
# Example of `prepare/1` callback.
prepare do
View
17 config/app.ex
@@ -0,0 +1,17 @@
+defmodule DynamoDemo do
+ use Dynamo.App
+
+ endpoint ApplicationRouter
+
+ config :dynamo,
+ # The OTP application associated to this app
+ # This is the name of the .app file generated by mix
+ otp_app: :dynamo_demo,
+ # The route from where public assets are served
+ # You can turn off static assets by setting it to false
+ public_route: "/public"
+
+ def version do
+ Keyword.get DynamoDemo.Mixfile.project, :version
+ end
+end
View
10 config/environments/dev.exs
@@ -0,0 +1,10 @@
+config :dynamo,
+ # Compile modules as they are accessed.
+ # This makes development easy as we don't
+ # need to explicitly compile files.
+ compile_on_demand: true,
+
+ # Every time a module in app changes, we
+ # will clean up defined modules and pick
+ # up the latest versions.
+ reload_modules: true
View
4 config/environments/prod.exs
@@ -0,0 +1,4 @@
+config :dynamo,
+ # On production, modules are compiled up-front.
+ compile_on_demand: false,
+ reload_modules: false
View
5 config/environments/test.exs
@@ -0,0 +1,5 @@
+config :dynamo,
+ # For testing we compile modules on demand,
+ # but there isn't a need to reload them.
+ compile_on_demand: true,
+ reload_modules: false
View
10 lib/dynamo_demo.ex
@@ -1,10 +0,0 @@
-defmodule DynamoDemo do
- def version do
- Keyword.get DynamoDemo.Mixfile.project, :version
- end
-
- def start do
- :ok = :application.start(:dynamo_demo)
- Dynamo.Cowboy.run DynamoDemo.App, port: System.get_env("PORT") || 3000
- end
-end
View
8 mix.exs
@@ -4,6 +4,7 @@ defmodule DynamoDemo.Mixfile do
def project do
[ app: :dynamo_demo,
version: "0.0.1",
+ compilers: [:elixir, :dynamo, :app],
deps: deps ]
end
@@ -12,11 +13,10 @@ defmodule DynamoDemo.Mixfile do
[]
end
- # Returns the list of dependencies in the format:
- # { :foobar, "0.1", git: "https://github.com/elixir-lang/foobar.git" }
defp deps do
- [ { :dynamo, git: "https://github.com/josevalim/dynamo.git" },
- { :cowboy, git: "https://github.com/josevalim/cowboy.git" },
+ [ { :mimetypes, git: "https://github.com/spawngrid/mimetypes.git" },
+ { :cowboy, "0.6.1", git: "https://github.com/josevalim/cowboy.git" },
+ { :dynamo, "0.1.0.dev", git: "https://github.com/josevalim/dynamo.git" },
{ :exjson, git: "https://github.com/guedes/exjson.git" } ]
end
end
View
5 mix.lock
@@ -1,3 +1,4 @@
[ "cowboy": "9ec5626171e0fb4b1e4bbb7a98f501866d004794",
- "dynamo": "1e11bbe237c5fce548720f4f3403446250ef2b9d",
- "exjson": "41597676a46058ba9df7fd106a26d6a7b8d59e39" ]
+ "dynamo": "bf03dfd4d2545f9b687cbb63eed56f536a996f9c",
+ "exjson": "41597676a46058ba9df7fd106a26d6a7b8d59e39",
+ "mimetypes": "e9dfab5aec98963589ecf13bdfcf0490667a730d" ]
View
BIN  public/responsibility.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 test/dynamo_demo_test.exs
@@ -1,9 +0,0 @@
-Code.require_file "../test_helper", __FILE__
-
-defmodule DynamoDemoTest do
- use ExUnit.Case
-
- test "the truth" do
- assert true
- end
-end
View
2  test/test_helper.exs
@@ -1,2 +0,0 @@
-DynamoDemo.start
-ExUnit.start
Please sign in to comment.
Something went wrong with that request. Please try again.