app/controllers/users_controller.rb
# POST /signup
# return authenticated token upon signup
POST /signup
return authenticated token upon signup
POST / signup return authenticated token upon signup
def create
    @user = User.create!(user_params)
    if @user.valid?
      auth_token = AuthenticateUser.new(@user.email, @user.password).call
      render json: { user: {
        name: @user.name,
        email: @user.email
      }, auth_token: auth_token }
    else
      render json: { error: @user.errors.full_messages }, status: :unauthorized
    end
  end
def create @user = User . create! ( user_params ) if @user . valid? auth_token = AuthenticateUser . new ( @user . email , @user . password ) . call render json : { user : { name : @user . name , email : @user . email } , auth_token : auth_token } else render json : { error : @user . errors . full_messages } , status : :unauthorized end end
POST /signup
return authenticated token upon signup
POST / signup return authenticated token upon signup