Can't connect to server with angular app

I’m having an issue trying to connect my Angular app to a SQL Server on a remote server. The issue is that the HTTP server is refusing the connection, but I have checked the server (firewall, etc) and the server is configured properly for the connection. The following is the code I’m using:

type import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { firstValueFrom } from 'rxjs';

@Component({
  selector: 'app-formulario',
  templateUrl: './formulario.component.html',
  styleUrls: ['./formulario.component.css']
})
export class FormularioComponent {
 

  
  staticData = {
    nombre: 'Ejemplo',
    apellido: 'Ejemplo',
    usuario: 'ejemplo',
    terminal: 'ejemplo',
    departamento: 'ejemplo'
  };
  
  constructor(private http: HttpClient) {}

  guardar() {
    console.log('presionaste el puto boton pinche menso')
    try {
          firstValueFrom(this.http.post('http://192.168.255.88:3000/guardar', this.staticData));
           console.log('Información guardada correctamente');
        } catch (error) {
          console.error('Error al guardar la información:', error);
      }
  }

  // async guardar(): Promise<void> {
  //   const data = {
  //     nombre: this.nombre,
  //    apellido: this.apellido,
  //     usuario: this.usuario,
  //     terminal: this.terminal,
  //    departamento: this.departamento
  //   };
 
  //   try {
  //     await firstValueFrom(this.http.post('http://192.168.255.88:3000/guardar', this.staticData));
  //     console.log('Información guardada correctamente');
  //   } catch (error) {
  //     console.error('Error al guardar la información:', error);
  //   }
  // }
}

I’m getting the following error:

POST http://192.168.255.88:3000/guardar net::ERR_CONNECTION_REFUSED

I have already enabled CORS and I’m using Node.js as a server on port 3000, but I’m still not sure what the issue is. Please help!

The issue is that the HTTP server is refusing the connection to http://192.168.255.88:3000/guardar.

Make sure that the server is running and accessible at that IP address and port. Additionally, ensure that there are no firewall restrictions blocking the connection.

If the server is running correctly and accessible, you can try the following solutions:

  1. Double-check the server configuration to ensure it allows connections from your Angular app’s domain.
  2. Verify that the server is listening on the correct IP address and port.
  3. Test the connection using a tool like Postman or cURL to ensure it is not a problem with your Angular app specifically.
  4. Make sure that the server is not blocking the request due to Cross-Origin Resource Sharing (CORS) restrictions. You can try enabling CORS on the server-side to allow requests from your Angular app.
  5. Check the server logs for any errors or additional information that could help diagnose the issue.

If none of these solutions work, please provide more details about your server setup and any error messages or additional information you have.