Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 2.83 KB

LearnElixir.md

File metadata and controls

68 lines (52 loc) · 2.83 KB

** ELIXIR BACKEND **

CMD IMPORTANTE

  • Ex : mix phx.new time_manager --app time_manager_app --module TimeManager --no-html --no-webpack
  • Ex: mix phx.gen.schema Blog.Post(Schema Module) blog_posts(table) title:string views:integer (data)
  • mix phx.gen.context #Generated a context with functions around an Ecto schema
  • Ex : mix phx.gen.context Accounts(Context Module) User(Schema) users name:string age:integer(data)
  • mix phx.gen.json #Generates controllers, views and context for JSON resource
  • Ex : mix phx.gen.json Accounts(Context Module) User(Schema) users name:string age:integer(data)

DOC IMPORTANTE

Show all route : mix phx.routers

scope "/", BootstrapWeb do pipe_through :browser

get "/users", UserController, :index

end

Other scopes may use custom stacks.

scope "/api", BootstrapWeb do pipe_through :api

resources "/users", UserController, except: [:new, :edit, :index]

scope "/tasks" do # api/tasks/*
 resources "/", TaskController, except: [:new, :edit, :update] #do
#   resources("/users", UserController, only: [:show])
#  end
  put("/:id", TaskController, :update)  # api/tasks/:id
  get("/users/:idUser", TaskUserController, :index) # /api/tasks/users/:idUser
end
#  get("/tasks", UserController, :index)
#  get("/tasks/:id", UserController, :show)
#  post("/tasks/", UserController, :create)
#  get("/tasks/users/:idUser", UserController, :show)

end end

Ecto

Mix Task