Use Angular with Laravel - laravel

Anyone know if the best aproach to use laravel and angular is to use angular as Front-End and laravel as back end , or can i use both of them in all in One ?
In the case of each option can you explain please why is that the best aproach ?
Thanks Guys !

The best approach is to create a RESTFUL api in laravel as the backend, and use angular as the font-end client. This is currently the most popular approach as angular is great for creating what are known as "Single Page Applications" (SPA's). SPA's are popular because they allow you to create a seamless user experience by appropriately handling asynchronous behaviour. By keeping your REST api separate from your UI, you can also then add other clients as needed, such as a mobile/native client.

Related

How can I implement frontend in API without using a framework?

hope you are having a great day.
I will get straight to the point, I have an application in Spring. I am using API calls from postman to retrieve my data.
Now I am asked to implement a front-end but without a framework, I was told that only ajax and javascript should do the trick.
How would I be able to implement this?
Keep in mind it is not an MVC application, but rather an API.
Thanks in advance
Several ways of doing so ! You can use
Javascript
Jquery
Angular JS
Check if below article helps
How to call a REST web service API from JavaScript?

Laravel: Understanding which api framework to choose

Our company is about to start a real estate project and have decided to go with the laravel 5.3 framework. The first phase is to write the apis and then these apis will be consumed by the mobile team and the frontend team to build the official mobile app and the web portal respectively.
Now I am confused whether to use laravel's built-in Resource controllers (as instructed in this tutorial http://www.programmableweb.com/news/how-to-build-restful-apis-using-php-and-laravel/how-to/2014/08/13) or use the Dingo Api framework.
Could you please help me which one should I go for and why as per the requirements i mentioned above?
Thanks in advance
Since, Laravel 5.3 comes with Passport (for api authentication), I would suggest you to use Resource controller, which is very simple and easy to work with, and also it create a meaningful end points
Route::resource('post','PostController');
GET /post/{post}
POST /post
EDIT /post/{post}/edit
DELETE /post/{post}

Lumen with components or laravel

I'm currently developing a web application and I expect a lot of visitors (potential thousands of concurrent visitors). For this reason I prefer the Lumen Framework over Laravel because of the size and better performance. But I miss some things that are excluded from Lumen since the last version, like sessions, views and session authentication.
So I have a choice: using the heavier Laravel framework, or use Lumen and add some Laravel components I need. My question is: what is better?
I know I can test some things on my own but I'm not that experienced and I'm wondering if anyone has some good pros or cons (or if you have another alternative I'm curious too).
I recommend you use Laravel for your purpose. Lumen 5.2 doesn't have views, sessions and can be a bit frustrating create a big website. And since the new version, not her philosophy. Lumen is now focused on JSON API's.
Only Stateless APIs
Lumen 5.2 represents a shift on slimming Lumen to focus solely on serving stateless, JSON APIs. As such, sessions and views are no longer included with the framework.
If you need access to these features, you should use the full Laravel framework.
https://lumen.laravel.com/docs/5.2/releases#5.2.0
If you need an API, is the perfect place to use Lumen. Share the database with the Laravel app (that will contains all the business logic) and you will have a fast API

Django rest framework + ionic2 + django channels

I want to develop real time native application and considering using Django as backend and ionic2 as frontend. But through the research i realize that websocket is needed for the app to be real-time. And django channels is the option.
The question is "is it possible to combinate django rest framework, ionic2 and django channels altogether?" And additionally if I try to implement push notification using cordova plugin, could it be also work altogether? I know this question is quite bad but I am quite a beginner so i want to know before trying this approach..
any advice will be great for me, Thanks buddies in advance!
Yes, it is.
Ionic is going to be only a consumer of your Django-rest-framework API and your Django services. In other words, the front-end can be in any technology you want.
On the other side, Django-rest-framework + Channels work perfectly together. They are supposed to be. I've recently built a project with those technologies and I can guarantee that there is a perfect separation between the asynchronous processes and the typical Django HTTP runserver process.

Phonegap and Django Authentication

I am in the middle of building a PhoneGap (Cordova) app which I would like to be able to talk to a Django site of mine. The steps needed to get the app working are:
Authenticate the user (stay logged-in across app restarts) (e.g. get session cookie from Django for communication with the service - where to store?). Note: The Django endpoint uses https.
When app receives push notification load some data from my django site.
Make selection on data and submit response back to my django site (will need the csrf token?)
I was able to sort out the push notifications but now I am wondering which solution would work best for the communication with Django.
As I understand there are two possible approaches:
Either to implement a REST service with something like tastypie or
try to setup the communication via ajax (e.g. jQuery)
At the moment I am thinking that going simply ajax might be the best approach since the app is fairly small and there are no additional requirement for a REST API.
It would be great if anyone could give me any pointers on how to solve this or share some experiece / code. Especially the steps of the authentication process are unclear to me.
I am not sure if this is still an open question but it is sure an interesting one.
I would strongly suggest on using the django-tastypie and you could start by using the docs which are indeed a great point of reference.
My experience until now has shown that I should always start by making my api clear(and rest) than choosing an easier faster solution(e.g. ajax) because if your app is a successful one, frameworks like tastypie help you scale.
The authentication process is pretty straightforward if you choose the basic one.
You just ask for the user credentials and there are many clients implementing the client side basic auth.
Fortunately, tastypie supports more than this. For example, the api authentication and you could read more here.
If you need anything else, please let me know.
Regards,
Michael.

Resources