React / Symfony: How to start my project? - reactjs

It's been a few days since I broke my head to find the right method but I can't make up my mind so I decide to call on your experience :)
My project is to develop a membership management site / dues / ... for a (small) association. I want to use React for the frontend and Symfony 4 for the backend because these are the two technologies that I master the best.
My question is: (1) should I start a Symfony project and integrate React, or (2) should I start a React project and create an API with Symfony for my application?
Indeed if I go on the first solution my biggest problem is that I do not see how to manage the routing of my application (via React or Symfony).
If I go on the second method, I am afraid that my application is less secure (report to the management of authentication).
That's it I hope to enjoy your lights and thank you in advance :)

I think the best approach is the second. If you manage routes through the backend, you don't have the advantages of SPA.
In the other hand, to secure data you can take a look at JWT (JSON Web Tokens). That way you can safely manage info between the app and the api.

You should take a look at this to ease the development:
https://api-platform.com/

Related

Develop backend (Spring) without frontend (angular)?

I am programming a spring-boot project. I only want to create the backend. Another developer will later on create the frontend with AngularJS.
I want to develope my backend without spending to much effort to create a test-frontend, since I dont know anything about JSP,Angular..
What should my Controllers(#Requestmapprings) return (Model, ModelAndView,JSON-Objects, Strings, ...??), so the angular-developer can use them for creating the view?
Is there any easy way to develop my backend without creating a frontend at all and still being able to test it somehow? I dont want to spend time to create basic Forms/Buttons/checkboxex but i would like to check if my scripts are working..
You must start looking into REST services.
https://spring.io/guides/gs/rest-service/
To see how it is consumed by angular please refer.
https://spring.io/guides/gs/rest-service/
You can get lots of tutorials and documentation on developing REST services independent of frontend.
I would suggest taking micro services approach based on the UI requirement and then segregate the services based on the functionality. This would make the code maintainability and development easier. If you are going to use spring-framework, it has vast stack of features, which are production ready.

Separate ReactJS app versus integrating with backend

Regarding of what backend you use to power the API behind a React app (Ruby on Rails, Node.js/Express, Java, etc), what are the consequences of making the frontend React app separate repository?
I like the idea of having my ReactJS app separated from my backend API code, just want to understand the pros/cons of going with this approach.
pros
front-end devs doesnt have to get familiar with backend
You can choose not to show your secret recipe.
can upgrade and deploy one without the other
Code Reusablity
Lazy loading for better UX
I actually dont have any cons to tell about this. it's just that i feel right developing apps like this. installing npm packages in RoR felt so wrong.
more Pros -
You new separate UI can link to more backends than 1 - think centralized UI for disparate components
Like Angular more, bang you got it
Like React more than Angular, bang you got it
Cons -
Needs added work to setup CORs
You will probably have to cookup secret sauce for pagination, serialization (i.e tied together even though separate) - not a problem if you follow a standard anyway
Need to have a long deep thought on behaviour when the backkend is down
Need to wrap brain around pull vs push
You now have 2 diff OS stacks & TCP stacks in the picture to increase your work on sys admin patching & understanding latency between the components
wrap brain around state & its management
IMHO separating the UI is worth all the cons given the pros outlined here & by Shan

express angular single page app archetecture

Hi i am a beginner to nodejs & angularjs.
I have a requirement for an angularjs application, i am planing to do the back end REST API's using expressjs.
For my application I have two parts; one front end UI for general users & one admin panel or managing the entire application database.
I found a number of angular-express seed projects on github.
So my question is that which one is the best choice for me among the following :
1. Doing a single app using express+angular(is it possible to create a separate area for admin)
2. Implement a middleware for REST API's and admin panel using node. Then do a separate angular-seed project.Host the two app separately.
Another question is that whether I should use express or sails js?
Anyone please can help me.
Thanks in advance.
If you're new to AngularJS i'd strongly recommend starting from nothing so that you get an overall look at how everything comes together, my personal experience is that it's better to use seed projects or generators should once you have a basic understanding of how an AngularJS and nodeJS project comes together
Technically both option one and two are valid however I would go with option one, this means you can build authentication and authorisation into your application and use that to stop people accessing the admin section - This reduces complexity because you don't have to manage multiple projects and may also benefit you personally as it allows you to dive into security and expand your knowledge.
Should you use express or sails? That comes down to exactly what you're building - each library has it's own pros and cons, i'd say it's down to you to weigh up these pros and cons and make a decision on what library you would like to go with.
You can use app generators. One of the best generator is Yeoman
And here Yeoman generators you can query the generator you want

REST APIs and a front end website - which framework to use?

over the last 2 months I taught myself Angular JS and ionic and have built a pretty effective iOS and Android client for a specific idea I have in mind. I am now embarking on prototyping a website for myself that this client will talk to.
The website will be pretty simple:
a) I am thinking the front end will be using a responsive bootstrap theme like this one: http://startbootstrap.com/template-overviews/freelancer/
b) The website will have a login function, and after login, allow subscribers to upload 'coupon' - that consists of a name, description and expiry date. This needs to be stored in the DB. I also plan to offer a search and edit functionality via the website
c) Now, I also want the backend to expose a REST API like, say, this form:
http://server.com/api/login
http://server.com/api/getAllCoupons
http://server.com/api/getCoupon/id=foo
etc
I've been researching various options and have come across:
1) Mean.io
2) Yeoman
3) Strongloop
At this stage, given I am completely new to web development, and only have an idea of Angular JS and a bit of Node js, I am confused on what to use
My criteria really is ease of use. I'd like a framework that lets me get up and running with a website and an API connected to it that can get data out of the website DB
Do you have a recommendation on the simplest and quickest way to go about it? I want to continue focusing on my mobile app and need the website to be as painless as possible.
Thank you

Laravel and Angular.JS - Web App Dev

I have started learning Laravel and Angular, for one of my project at university. I want to rebuild the website www.lolcalculator.com with these two frameworks but I cant figure out exatly the best way to do that. From Laravel I want the less posible, because I will focus on Angular.
Can someone with more experience help me?
For example, do I need to use routing on both sides? Which functions of the website I should cover with Laravel(Mailer, Auth, Routing...) and which using Angular?
I just need to understand a bigger image, not in details.
Tnx a lot.
All the best :D
There's quite some information on the net regarding Laravel and Angular, but this one in particular is one that I found useful: http://scotch.io/tutorials/php/create-a-laravel-and-angular-single-page-comment-application.
You may also want to consider writting a front-end app in Angular and a separate back-end app in Laravel. The back-end app can then expose an API, consumed by the Angular front-end.

Resources