I am trying to follow David Mosher's tutorial on going end-to-end with angular JS on youtube: http://www.youtube.com/watch?v=hqAyiqUs93c.
Everything was going fine until I attempted to route the /auth/login and auth/logout urls to the Authentication Service, as seen in the video at about 14:30. When I attempt to login, I receive a 404 Not Found Error. I have tried messing around with the route's URL, but to no avail. I am running locally on MAMP with MySQL and Laravel.
Here's my code for routes.php
Route::get('/', function(){
return View::make('index');
});
Route::post('/auth/login/', 'AuthController@login');
Route::get('/auth/logout/', 'AuthController@logout');
and my code for 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!'));
}
}
lastly, code for authentication service
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/");
}
}
})