title: lumen NotFoundHttpException in RoutesRequests.php
body: <p>I know this question has been asked before <a href="https://stackoverflow.com/questions/29728973/notfoundhttpexception-with-lumen">here</a>. (Please clink on the link before you vote to close it under the duplicate tag.) But none of the solutions have worked for me.</p>
  
  <p>I can access <code>/</code> without any errors. But when I try to use a get request to login I get this error:</p>
  
  <pre><code>NotFoundHttpException
  in RoutesRequests.php (line 594)
  at Application-&gt;handleDispatcherResponse(array(0))
  in RoutesRequests.php (line 532)
  at Application-&gt;Laravel\Lumen\Concerns\{closure}()
  in RoutesRequests.php (line 781)
  at Application-&gt;sendThroughPipeline(array(), object(Closure))
  in RoutesRequests.php (line 534)
  at Application-&gt;dispatch(null)
  in RoutesRequests.php (line 475)
  at Application-&gt;run()
  in index.php (line 28)
  </code></pre>
  
  <p><code>index.php (line 28)</code> points to <code>$app-&gt;run();</code> </p>
  
  <p>Here is my code for the login form page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;notes!&lt;/title&gt;
      &lt;!-- &lt;link rel="stylesheet" type="text/css" href="{{ url('../assets/css/main.css') }}"&gt; --&gt;
      &lt;style&gt;
              body {
              background-color: #ffffff;
          }
  
          .banner {
              margin: 100px auto;
              text-align: center;
              vertical-align: middle;
              font-family: 'Open Sans', sans-serif;
              font-size: 30px;
              color: #333333;
          }
  
          .loginContainer {
              width:30%;
              margin: 50px auto;
              vertical-align: middle;
              background-color: #333333;
              border:2px;
              border-radius:10px;
          }
  
          form {
              margin: 0 auto;
              padding: 50px;
          }
  
          form input {
              display: block;
              width: 300px;
              margin: 0 auto;
              margin-top: 5px;
              padding: 5px;
              font-size: 30px;
          }
  
          form button {
              display: block;
              width: 314px;
              margin: 0 auto;
              margin-top: 5px;
              padding: 5px;
              border-radius: 5px;
              border: none;
              background-color: #3366ff;
              color: #ffffff;
              font-size: 30px;
          }
      &lt;/style&gt;
      &lt;link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;!-- &lt;div class="navbar"&gt;
           &lt;ul&gt;
           &lt;li&gt;Login&lt;/li&gt;
           &lt;li&gt;About Me!&lt;/li&gt;
           &lt;/ul&gt;
           &lt;/div&gt; --&gt;
      &lt;div class="banner"&gt;
          &lt;h1&gt;Welcome to notes!&lt;/h1&gt;
          &lt;h4&gt;Add notes, to-do lists and more!&lt;/h4&gt;
      &lt;/div&gt;
      &lt;div class="loginContainer"&gt;
          &lt;form class="signin" method="get" action="/login/"&gt;
          &lt;input type="email" id="inputEmail" placeholder="Email" required="" autofocus=""&gt;
          &lt;input type="password" id="inputPassword" placeholder="Password" required=""&gt;
          &lt;button type="submit"&gt;Sign in&lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the code for <code>routes.php</code>:</p>
  
  <pre><code>&lt;?php
  
  /*
  |--------------------------------------------------------------------------
  | Application Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register all of the routes for an application.
  | It is a breeze. Simply tell Lumen the URIs it should respond to
  | and give it the Closure to call when that URI is requested.
  |
  */
  
  $app-&gt;get('/', function () use ($app) {
      return view('welcome');
  });
  
  $app-&gt;get('login/','UsersController@authenticate');
  $app-&gt;post('todo/','TodoController@store');
  $app-&gt;get('todo/', 'TodoController@index');
  $app-&gt;get('todo/{id}/', 'TodoController@show');
  $app-&gt;put('todo/{id}/', 'TodoController@update');
  $app-&gt;delete('todo/{id}/', 'TodoController@destroy');
  
  ?&gt;
  </code></pre>
  
  <p>Here is the <code>UsersController.php</code> file:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Http\Controllers\Controller;
  
  use Illuminate\Support\Facades\Hash;
  
  use Illuminate\Http\Request;
  
  use App\Users;
  
  class UsersController extends Controller
  
  {
  
    public function __construct()
  
     {
  
  //        $this-&gt;middleware('auth:api');
  
     }
  
     /**
      * Display a listing of the resource.
      *
      * @return \Illuminate\Http\Response
      */
  
     public function authenticate(Request $request)
  
     {
  
         $this-&gt;validate($request, [
  
         'email' =&gt; 'required',
  
         'password' =&gt; 'required'
  
          ]);
  
        $user = Users::where('email', $request-&gt;input('email'))-&gt;first();
  
       if(Hash::check($request-&gt;input('password'), $user-&gt;password)){
  
            $apikey = base64_encode(str_random(40));
  
            Users::where('email', $request-&gt;input('email'))-&gt;update(['api_key' =&gt; "$apikey"]);;
  
            return response()-&gt;json(['status' =&gt; 'success','api_key' =&gt; $apikey]);
  
        }else{
  
            return response()-&gt;json(['status' =&gt; 'fail'],401);
  
        }
  
     }
  
  }    
  
  ?&gt;
  </code></pre>