When I run http-server -o with angularjs(frontend) to use api from symfony (backend) for login, I get this error:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed) :8080/app/api/src/AppBundle/Controller/MainController.php
error Impossible d'accéder au serveur.
connection.js
'use strict';
angular.module('myapplication.connection', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/connection', {
templateUrl: 'connection/connection.html',
controller: 'connectionCtrl'
});}])
.controller('connectionCtrl', ['$http', '$scope', function($http, $scope) {
$http.post('api/src/AppBundle/Controller/MainController.php', {formType:'connection'})
.then(function (response) {
$scope.connection = response.data;
}, function(response) {
$scope.connection = "Impossible d'accéder au serveur.";
});
}]);
connection.html(form)
<div class="content">
<h2>Connexion</h2>
<div>{{ connection }}</div>
</div>
How do I solve this error?