I have defined the following routes in
router.ex
scope "/api/v1", ProjWeb do
pipe_through :api
post "/sign_up", UserController, :sign_up
post "/sign_in", UserController, :sign_in
end
Here is the controller actions
def sign_up(conn, %{"user" => user_params}) do
# example code
# response
end
def sign_in(conn, %{"user" => %{"email" => email, "password" => password}}) do
### resp
end
/api/v1/sign_up
works with the following payload
{
"user": {
"email": "[email protected]",
"name": "Krishna",
"password": "SUPER_SECRET_PASS!"
}
}
/api/v1/sign_in
with the following payload
{
"user": {
"email": "[email protected]",
"password": "SUPER_SECRET_PASS!"
}
}
Throws the following error
no function clause matching in ProjWeb.UserController.sign_in/2
Logs:
# 1
%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, before_send:...}
# 2
%{}
Content-Type: application/json
– Justin WoodContent-Type: application/json
I was sendingContent-Type: application/javascript
. would be happy to accept an answer if you post it. – Vamsi Krishna B