laravel 与 React 前端一起使用的最佳后端框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40954410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
best backend framework to use with React frontend
提问by esoni
i have to developed a web app intregated also with Android Phone. I have choosen to use react js with redux for the frontend and native android for mobile app. I need to develop a backend that publish some restfull api and if possible push notification management. The backend should be connected data stores ( i need a framework compatible with mongo db and mysql). I need an high level of performance. The solutions that meet these reqs that i found on the web are: sails loopback laravel hibernate
我必须开发一个也与 Android 手机集成的网络应用程序。我选择将 react js 与 redux 用于前端,将本机 android 用于移动应用程序。我需要开发一个发布一些restfull api的后端,如果可能的话,推送通知管理。后端应该是连接的数据存储(我需要一个与 mongo db 和 mysql 兼容的框架)。我需要高水平的性能。我在网上找到的满足这些要求的解决方案是:sails loopback laravel hibernate
What is the best solution that met these reqs and if is compatible with react ? i need a production solution Thanks
满足这些要求以及是否与 react 兼容的最佳解决方案是什么?我需要一个生产解决方案谢谢
回答by Antonio Carlos Ribeiro
If you are going full API, no HTML involved, Laravel Lumenwould be my choice for a RESTful API. It's blazing fast, easy to develop and it's... Laravel! But the "best" always come with some sort of personal preference, right?
如果你使用完整的 API,不涉及 HTML,Laravel Lumen将是我的 RESTful API 选择。它速度极快,易于开发,而且是... Laravel!但是“最好的”总是带有某种个人偏好,对吗?
When building APIs, what you need to achieve is to have a endpoints (restful) and those endpoints to return JSON. You make a resquest to an URL, and you get a JSON back, as simple as that. This is something you will get with most framerworks out there: Rails (Ruby), Django (Python), Node (Javascript), Slim (PHP), Symfony (PHP), Lumen (PHP), Laravel (PHP), and many many others. Whatever you choose you'll probably have pros and cons, so choose something you like to code with.
在构建 API 时,您需要实现的是拥有一个端点(restful)和那些返回 JSON 的端点。你向一个 URL 发出请求,然后你得到一个 JSON,就这么简单。这是大多数框架作品都会得到的东西:Rails (Ruby)、Django (Python)、Node (Javascript)、Slim (PHP)、Symfony (PHP)、Lumen (PHP)、Laravel (PHP) 等等其他。无论您选择什么,您都可能有利有弊,因此请选择您喜欢使用的代码。
Laravel Passportis is also something you have to consider those days. It's API authentication done the right way and builtin Laravel 5.3 Framework. So if your app needs Authentication & Authorization, you better consider a framework abe to do that securely via OAuth2.
Laravel Passport也是你当时必须考虑的事情。它的 API 身份验证以正确的方式完成并内置于 Laravel 5.3 框架中。因此,如果您的应用程序需要身份验证和授权,您最好考虑一个框架 abe 通过 OAuth2 安全地做到这一点。
回答by lephleg
It really depends on with what language you are more comfortable with.
这实际上取决于您更熟悉哪种语言。
If PHP is OK with you. Laravel 5.3is a very robust solution and covers all your requirements. Great community and rich documentation.
如果 PHP 对你没问题。Laravel 5.3是一个非常强大的解决方案,涵盖了您的所有需求。伟大的社区和丰富的文档。
Also if performance is a priority, Lumen 5.3is a great lightweight alternative.
此外,如果优先考虑性能,Lumen 5.3是一个很好的轻量级替代品。