ios – Publish Request utilizing Alamofire to Node Server


I’m consuming a Login API from my node.js server deployed on EB. It really works fully file in Postman after I do a submit request to :

Safe://mydomain dot com/login

Physique :
{
“e mail” : e mail,
“password” : password
}

However I’m attempting to do it in Swift and it retains throwing errors. Right here is my code :

         func loginFunction()
            {
    
             let loginURL = "login URL"            
             if let e mail = emailField.textual content, let password = passwordField.textual content
                       {
                        
                    let login = [
                        "email" : email as String,
                        "password" : password as String]
                    let headers : HTTPHeaders = ["Content-Type" : "application/json"]
                    
                    AF.request(URL.init(string: loginURL)!, technique: .submit, parameters: login, 
                       encoding: JSONEncoding.default, headers: headers).responseString { (response) in
                            print(response.end result)
        
                        }
        
                       }
            }

I maintain getting 502 Unhealthy Gateway error, despite the fact that it really works okay after I take a look at this in Postman. What am I doing fallacious?