mercredi 5 septembre 2018

Is there a way to not start session state when hitting API route?

In Laravel 5, when I setup an API route (api.php), and I attempt to hit that endpoint, it seems like the entire Laravel session starts.

For example, when I hit a basic API route/endpoint Laravel attempts to read values from the .env file (like reading values for session state server, etc). I don't want it to do that for certain API routes.

Why would it try to read from session server when it doesn't need to? The route isn't behind any authentication.

I have feeling Laravel starts up some internal workings on every request. How can I have it NOT do that for simple routes like this one.

For example, here's my route:

Route::get('/something', function() {
    response('', 200)
        ->header('Content-Type', 'text/plain');
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire