I’ve executed a ‘mix deps.update --all’ which in hindsight seems like not such a good idea.
I was/am on Phoenix version “~> 1.2.3”. And I’m building an API with the aid of Phoenix and JA_Serializer.
After the update I now get a warning about Plug.MIME.type/1 id deprecated each time my API endpoint is hit. From what I’ve read I understand that I need to update the config.exs to use the :mime key not plug
which I’ve done:
# Configure the JSON format encoder
config :phoenix, :format_encoders,
“json-api”: Poison
config :mime, :types, %{
"application/vnd.api+json" => ["json-api"]
}
And I’ve executed :
mix deps.clean mime --build
mix deps.get
restarted phoenix (mix phoenix.start).
But I continue to get the warnings. Everything still works, but It bugs the life out of me seeing the error messages and it really makes reading the log as I develop harder.
My router.ex file seems to be in order according to the guidelines (see below).
Any pointers on what I can do or what I did wrong?
Go easy on me - first time poster
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json", "json-api"]
end
# Authenticated Requests
pipeline :api_auth do
plug :accepts, ["json", "json-api"]
plug Guardian.Plug.VerifyHeader, realm: "Bearer"
plug Guardian.Plug.LoadResource
plug Exposition.DeserializePlug
end
scope "/", Exposition do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
# Confirm Email address (after registration)
get "/confirm_email", ConfirmEmailController, :confirm
end
scope "/api", Exposition do
pipe_through :api
# Reset
get "/reset", ResetController, :index
# Registration
post "/register", RegistrationController, :create
# Password Reset
post "/password_reset", PasswordResetController, :password_reset
# Sessions
# -- replaced with the below resources "/session", SessionController, only: [:index]
post "/token", SessionController, :create, as: :login #What this is saying is that POST requests to the endpoint /api/token should be routed to the create method on the SessionController — and that within our code, we wish to refer to this route as login
end
scope "/api", Exposition do
pipe_through :api_auth
get "/user/current", UserController, :current
resources "/users", UserController, except: [:new, :edit, :create]
post "/newusers", NewuserController, :create
....
Plug.MIME.type/1 is deprecated, please use MIME.type/1 instead
(phoenix) lib/phoenix/controller.ex:636: Phoenix.Controller.do_render/4
(exposition) web/controllers/expo_controller.ex:1: Exposition.ExpoController.action/2
(exposition) web/controllers/expo_controller.ex:1: Exposition.ExpoController.phoenix_controller_pipeline/2
(exposition) lib/exposition/endpoint.ex:1: Exposition.Endpoint.instrument/4
(exposition) lib/phoenix/router.ex:261: Exposition.Router.dispatch/2
(exposition) web/router.ex:1: Exposition.Router.do_call/2
(exposition) lib/exposition/endpoint.ex:1: Exposition.Endpoint.phoenix_pipeline/1
(exposition) lib/exposition/endpoint.ex:1: Exposition.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) /Users/darren/work/code_projects/exposition/api/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4