E
E
Evgeny Romashkan2018-05-16 16:09:29
Laravel
Evgeny Romashkan, 2018-05-16 16:09:29

Laravel, what's the best way to embed some API with AJAX in a small (Non-SPA) site?

There is a small educational project - an online store. The site is rendered completely on the server, but I want to do a couple of things through AJAX (Uploading products to the store and adding the user to the cart, for example).
Is it worth it to use Laravel passport, tokens and all this for this (As I understand it, with the help of these tools authorization for the API is implemented), take out routes in api.ph
Is it possible to simply add a couple of routes (post and put) to web.php and use ready-made middleware (auth to add to cart, admin_priveleges to add products)? Or is this approach unacceptable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-05-16
@Sanasol

Or is this approach unacceptable?

An evil programmer will come out of the screen and beat his hands. (probably)
But technically, of course, anything is possible, as long as it works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question