express angular single page app archetecture - angularjs

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

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.

React / Symfony: How to start my project?

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/

RESTFUL App in symfony 3

I am still quite confused about REST API, Angular and so on.
I would like to build simple web app which allows users to book events and I would like to do it in Symfony 3 + Angular.
In future, I could make it work on mobile phones as well.
The reason I want to do it is to learn symphony 3, REST API and Angular better and to increase chance I will get hired.
I have few questions:
1) Apart of the fact I am going to learn Angular what is the real benefit of using Angular rather than twig templates and HTML for the front end ?
2) As far I have seen people usually suggesting light weight frameworks to build REST API. Why would not they suggest symphony ?
3) What would you suggest to build to show you have got good skill set to get hired ?
1) Angular a complete framework. In your case, you would use angular as front end. This would be two options.
First one is completely using Angular, Symfony serves the RESTful API. Then twig is not involved anymore.
The other is used Angular within twig, acting like a server side rendering Angular. This way is not very common right now, rather less examples could be found.
In any case, Angular could provide single-page application, which could give your users better user experience, faster load speed, move the html view part completely to browser(make server less tasks regarding rendering the view). You could also achieve this by using twig+javascript, but it would be a bit more complex depends on your skills.
But in my opinion, the best benefits would be separate the frontend and backend from architecture perspective.
2) Symfony is a very complete PHP framework. Building a REST API is only an example of using Symfony. And in this way, some features from Symfony could not be used. I would say some lightweight framework would deliver the same result as using Symfony. It would also be easier using some lightweight framework(less code, less configuration, etc.). However, the performance of Symfony and large community might also need to take into consideration when you choose the right framework.
3) Always a good protfolio by showing your experience and skills.

Is Angularjs used to create SPA website?

I'm not familiar with it, can you clarify it? I don't want to create a SPA website.
Can I use Angularjs for non-spa website?
AngularJS has been created for Single Page App (SPA) website. But this doesn't restricts one from creating non-SPA website or application. If one has incorporated routing in their application, then it makes a SPA application. I have worked on various applications with AngularJS as the scripting framework, some were SPA and some were non-SPA. It's actually to the developers or the application to decide to go with SPA or not.
AngularJS was cleverly built by some guys at Google and is open source. It is absolutely not directly a SPA. Over the years I have heard some people make wild statements like "Well, if you don't use Angular for its SPA features, then you might as well just use KnockoutJS!"
Nothing could be further from the truth on that as there are so many examples to pull from to defeat that argument!
You can use it without a database or file system and stub things out for testing, but you certainly want to consider your goals.
Build a Menu System with Angular - you can have a complete database driven menu system without any SPA.. so no routing with ng-route etc...
Plenty of people start out NOT doing a SPA as you just added an extra layer of complexity in understanding how Angular works. So much power and things to build without the single page application.
Baby Steps!

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

Resources