php – Laravel 6 Without Blade-ThrowExceptions

Exception or error:

I have this Advanced Programming assignment building an e-commerce website. I am using Laravel 6. However, the assignment states that the server must be independent of the client, therefore I cannot use blade. Instead all the client-side must only comprise HTML5, CSS and Javascript. How can I go about linking my backend with my frontend? I have tried searching online for an answer but since I’m very new to Laravel, I don’t quite understand how to go about this. Could you guys point me the right direction?

How to solve:

What your assignment is asking is to create a restless backend API and frontend to consume it. When you are going to access your site you will be contacting the frontend and then the frontend is going to retrieve what info it needs from the backend and display them to you. Usually, the backend and frontend run on different servers (eg a php server for the backend and node.js for the frontend) but this isn’t always the case.

Basically he wants two separate projects the backend and the frontend.

The frontend can be created by using just html-css-javascript or by using react.js, vue.js or any other library for building ui’s.

In both cases you will use ajax call to get the info from your backend (in your case the laravel app) to the frontend.

  • Check this tutorial for building a backend api with laravel.
  • Check this tutorial for consuming api in html.
  • Check this tutorial for consuming api with vue.js

Leave a Reply

Your email address will not be published. Required fields are marked *