Skip to content

Instantly share code, notes, and snippets.

@batwicket
Created July 7, 2014 22:42
Show Gist options
  • Save batwicket/87688fcbbac23f4dbf72 to your computer and use it in GitHub Desktop.
Save batwicket/87688fcbbac23f4dbf72 to your computer and use it in GitHub Desktop.
proto router.ex for phoenixframework
defmodule Ws.Router do
use Phoenix.Router
plug Plug.Static, at: "/static", from: :ws
get "/users/", Ws.Controllers.Users, :show, as: :page
# put "/users/", Ws.Controllers.Users, :update
post "/users/", Ws.Controllers.Users, :create
delete "/users/", Ws.Controllers.Users, :destroy
get "/users/:user", Ws.Controllers.Users, :show, as: :page
put "/users/:user", Ws.Controllers.Users, :update, as: :page
post "/users/", Ws.Controllers.Users, :create
delete "/users/:user", Ws.Controllers.Users, :destroy, as: :page
resources "users", Controllers.Users do
resources "comments", Controllers.Comments
end
scope path: "admin", alias: Controllers.Admin, helper: "admin" do
resources "users", Users
end
end
@batwicket
Copy link
Author

hmm.. ok.. so with the resources entry how can i hook up the controller to handle the 7 different REST cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment