當我試圖按照大衛·毛思迪的YouTube上會端至端具有角JS教程未找到錯誤。404 Laravel
一切都進行得很順利,直到我試圖路由/認證/註冊和認證/註銷URL發送到身份驗證服務,在大約14:30在視頻中看到。當我嘗試登錄時,我收到一個404 Not Found Error。我試圖弄亂路線的URL,但無濟於事。我使用MySQL和Laravel在本地運行MAMP。
這裏是我的routes.php文件
Route::get('/', function(){
return View::make('index');
});
Route::post('/auth/login/', '[email protected]');
Route::get('/auth/logout/', '[email protected]');
代碼和我的AuthController
代碼<?php
class AuthController extends BaseController {
public function login()
{
if(Auth::attempt(array('email' => Input::json('email'), 'password' => Input::json('password'))))
{
return Response::json(Auth::user());
} else {
return Response::json(array('flash' => 'Invalid username or password'), 500);
}
}
public function logout()
{
Auth::logout();
return Response::json(array('flash' => 'Logged Out!'));
}
}
最後,身份驗證服務的代碼
angular.module("epicApp")
.factory('AuthenticationService', function($http, $location){
return{
login: function(credentials){
return $http.post("/auth/login/", credentials);
},
logout: function(){
return $http.get("/auth/logout/");
}
}
})
您可以複製從控制檯的錯誤網址是什麼? – devo