Support the ongoing development of Laravel.io →
Configuration Views Blade

How do you properly set up a Laravel back-end API only with Angular front end so that Laravel does not use the index.blade.php?

All the tutorials I found use the index.blade or layout.blade, I want to simply return the index.html from Angular. No views will be rendered via Laravel.

If you know how, or know a guide / tutorial please let me know. I simply have not found any.

Most just say in routes.php use this:

Route::any('{path?}', function()
{
    return view("index");
})->where("path", ".+");

But that just serves up the index.blade

Thanks,

dave

Last updated 3 years ago.
0

Did you already took a look at Lumen? It should work perfectly in combination with Angular :)

0

If you're going to create a API based application, you can use a index.html to render everything on it. Use the index.php for the requests only should do

0

I did look at Lumen and it seemed like the better of the 2 since I only really need the basics, not a fully loaded framework.

But the packages I currently have, I am not sure if they are lumen friendly. If it works for Laravel 5 should it work with Lumen?

I have my angular index.html in app/public/index.html but going to dev.local/ loads the resources/views/index.blade.php which is not what I want, how to tell laravel to render the angular index.html? or render nothing at all.... not sure if i am doing this right with angular files inside laravel?

0

@movepixels if it works for Laravel 5 it will surely work for with Lumen. Lumen is exactly what you need.

0

I did dowload and start looking into it, but first thing I noticed was my current app I have 100+ controllers and each has Request/Folder/FormRequest and DeleteRequest which I like

Lumen I did not see this, the docs anyways have that old style validator all in the controller and I do not want to re-write what I currently have to and older style of Laravel.

If the option for FormRequest is available in Lumen I would opt for it.

0

Maybe you can use REST? I do ajax request from my react.js frontend to laravel end from laravel i send json response...

public function deletetrip($id) {
		$trip = Trip::find($id);

		if($trip->delete()) {
			$result = ["message" => ["Deleted successfully!"], "tripId" => $id];
			$response = response()->json($result)->header("Access-Control-Allow-Origin", "*");
		} else {
			$result = ["message" => ["Something went wrong!"]];
			$response = response()->json($result, 440)->header("Access-Control-Allow-Origin", "*");
		}

		return $response;
	}
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.