router.ex 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. defmodule GiomWeb.Router do
  2. use GiomWeb, :router
  3. pipeline :browser do
  4. plug :accepts, ["html"]
  5. plug :fetch_session
  6. plug :fetch_flash
  7. plug :protect_from_forgery
  8. plug :put_secure_browser_headers
  9. end
  10. pipeline :api do
  11. plug :accepts, ["json"]
  12. plug :fetch_session #
  13. plug :protect_from_forgery # csrf koruması için api pipeline bu eklenir + fetch_Session
  14. end
  15. pipeline :api_public do
  16. plug :accepts, ["json"]
  17. end
  18. scope "/", GiomWeb do
  19. pipe_through :browser # Use the default browser stack
  20. get "/", PageController, :index
  21. resources "/stocks", StockController
  22. resources "/ists", IstController
  23. post "/ists/get_stockname", IstController, :get_stockname
  24. resources "/points", PointController
  25. resources "/ptrans", PtransController
  26. resources "/stocktrans", StocktransController
  27. resources "/deneme", DenemeController
  28. end
  29. # Other scopes may use custom stacks.
  30. scope "/api", GiomWeb do
  31. pipe_through :api
  32. post "/stock/get_stockname", StockController, :get_stockname
  33. end
  34. # farklı scopelar kullanarak, routelarımızı ayırabiliriz.
  35. # public api de csrf koruması kullanılmıyor mesela.
  36. scope "/api", GiomWeb do
  37. pipe_through :api_public
  38. post "/public/stock/get_stockname", StockController, :get_stockname
  39. end
  40. end