How to enable CORS in order to obtain information from API REST?

How to enable CORS in order to obtain information from API REST , Because now i have this error :

XMLHttpRequest cannot load http://localhost:8080/bonita/loginservice. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost’ is therefore not allowed access.

when i execute this code:

  'use strict';
    
    

(function(){
        
        var appMainModule = angular.module('appMainModule',['ngBonita']);
        
        appMainModule.config(function(bonitaConfigProvider){
        bonitaConfigProvider.setBonitaUrl('http://localhost:8080/bonita');
        		});
        
        		
        
        appMainModule.controller('AppController',['$scope','$log','bonitaConfig','bonitaAuthentication','ProcessDefinition','HumanTask',function($scope,$log,bonitaConfig,bonitaAuthentication,ProcessDefinition,HumanTask){
        		
        		
        		bonitaAuthentication.login('root.root','root').then(function(){
        		
        		$log.log('Usuari logejat: '+bonitaConfig.getUserName() + '(identificador: '+ bonitaConfig.getUserId() +')');	
        		
        		
        			
        		})
        		
        		}]);
        		
        })();'

    

Regards.

This is not a Bonitasoft question but a web server one.

However here are a couple of links for you to look at (google search):

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
http://enable-cors.org/
http://www.w3.org/TR/cors/

and specifically for Apache:

http://enable-cors.org/server_apache.html
http://stackoverflow.com/questions/27249476/enabling-cors-on-apache

regards

thanks!.