使用laravel作为后端,使用angular作为前端 [英] work with laravel as backend and angular as frontend

查看:80
本文介绍了使用laravel作为后端,使用angular作为前端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始一个项目,我想知道使用angular作为前端和laravel作为后端的最佳方式和最广为接受的方式

i am starting a project i want know that what is the best and most accepted way of using angular as front end and laravel as back end

我可以在laravel的查看文件夹中喜欢吗,我会安装角形吗?

can i do like in view folder of laravel i will install angular is it ok??

我试图为此创建api,在angluar中,我将调用该api.

i tried to create api for that and in angluar i will call that api.

执行此操作最常用的方法是什么,我已经看过有关此操作的教程,但是大多数教程都是针对有角度的版本2及其过时的

what is the most used way for doing this i have seen tutorials over this but most of the tuts are for angular version 2 and its outdated

所以您能告诉我任何一种共同使用laravel 5.6和angular 5或4的方法

so can you please tell me any way to work laravel 5.6 and angular 5 or 4 together

请给我您的建议和想法

推荐答案

因此,基本上有两种方法可以做到这一点.

So basiclly there are two ways you can do this.

将所有内容保存在一个应用程序中,然后按照您的建议进行操作并放入/view中. Laravel有一个php artisan preset react,它为React设置了应用程序,但是据我所知,没有针对Angle的应用程序,但是可以确定您可以找到有关如何在Laravel项目中包含Angular的教程.

One keep everything in one app, and do as you suggested and put in /view. Laravel has a php artisan preset react which sets the application up for React, but as far as i know there is not one for angular but sure you can find a tutorial on how to include Angular in your Laravel project.

第二种方法是让它们分开,有一个提供API的Laravel/Lumen应用程序,另一个运行Angular项目的项目,而不是您的Angular项目将通过在Localhost示例上运行的两个独立服务器调用Laravel的api .我只是回答了另一个类似的问题,即这样做的好处.

The second way is keeping them seperated having a Laravel/Lumen app that provides there API, and a another project that has the Angular project running, than your Angular project will be calling the Laravel's api through two seperate servers running on Localhost example. I just answered another simillar questions of the benefits of doing it like this.

在此处阅读: https://stackoverflow.com/a/49181795/2783379

这篇关于使用laravel作为后端,使用angular作为前端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆