0
각도로 로그인하고 싶지만 폼을 제출하자마자 콘솔 POST에서이 오류가 발생합니다 http://localhost/angulav/public/auth 500 (내부 서버 오류). 각도 경로 오류 - POST http : // localhost/angulav/public/auth 500 (내부 서버 오류)
이
내 경로Route::any('/', function() {
return view('layout.master');
})->where('path', '.+');
Route::post('/auth', '[email protected]');
이 내 userController이다 JS
angular.module('myApp').controller('userController', ['$scope', '$http', function($scope, $http){
angular.extend($scope, {
doLogin: function(loginForm) {
$http({
headers: {'Content-Type': 'application/json'},
url: 'auth',
method: "POST",
data: {
username: $scope.login.username,
password: $scope.login.password
}
}).success(function(response){
console.log(response);
});
}
});
이 내 HTML
<form class="" ng-submit="doLogin(loginForm)">
<div class="form-group">
<label for="username">Username:</label>
<input id="username" class="form-control" ng-model="login.username" type="text" name="username" placeholder="Enter username">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input id="password" class="form-control" ng-model="login.password" type="password" name="password" placeholder="Enter username">
</div>
<div class="form-group">
<input class="btn btn-primary pull-right" id="username" type="submit" value="Submit">
</div>
</form>
입니다 이것은 내 usercontroller.php입니다
public function login(Request $request)
{
$user_data = [
'username' => $request->input('username'),
'password' => $request->password('password')
];
if (Auth::attempt($user_data)) {
return response(Auth::user(), 201);
} else {
return response('username and password do not match', 403);
}
}
우편 배달부에서 사용해 보셨습니까? –
@PareshGami : 우편 배달부 란 무엇입니까? – nana
포스트맨은 개발을 시작하기 때문에 API를 테스트 할 수있는 도구입니다. 크롬을위한 Google 우체부 검색 –