Skip to content

Commit

Permalink
Phoenix: added lib directory
Browse files Browse the repository at this point in the history
before this, the lib directory is not checked in
because .gitignore in the root directory ignores it
komarserjio#60
  • Loading branch information
williamn committed Nov 29, 2015
1 parent 22c623f commit c999d55
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
30 changes: 30 additions & 0 deletions phoenix/notejam/lib/notejam.ex
@@ -0,0 +1,30 @@
defmodule Notejam do
use Application

# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false

children = [
# Start the endpoint when the application starts
supervisor(Notejam.Endpoint, []),
# Start the Ecto repository
worker(Notejam.Repo, []),
# Here you could define other workers and supervisors as children
# worker(Notejam.Worker, [arg1, arg2, arg3]),
]

# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Notejam.Supervisor]
Supervisor.start_link(children, opts)
end

# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
Notejam.Endpoint.config_change(changed, removed)
:ok
end
end
39 changes: 39 additions & 0 deletions phoenix/notejam/lib/notejam/endpoint.ex
@@ -0,0 +1,39 @@
defmodule Notejam.Endpoint do
use Phoenix.Endpoint, otp_app: :notejam

socket "/socket", Notejam.UserSocket

# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/", from: :notejam, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt)

# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
end

plug Plug.RequestId
plug Plug.Logger

plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison

plug Plug.MethodOverride
plug Plug.Head

plug Plug.Session,
store: :cookie,
key: "_notejam_key",
signing_salt: "Nd5mMdx1"

plug Notejam.Router
end
3 changes: 3 additions & 0 deletions phoenix/notejam/lib/notejam/repo.ex
@@ -0,0 +1,3 @@
defmodule Notejam.Repo do
use Ecto.Repo, otp_app: :notejam
end

0 comments on commit c999d55

Please sign in to comment.