Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThomas Euget
10,615 Pointsexpress vs angular?
So in which case should we use Angular, and which case should we use express?
5 Answers
jason chan
31,009 PointsExpress is backend to create an API and basically database programming.
Frontend is to create buttons and interfaces. We use angularjs to communicate with an api.
Thomas Euget
10,615 Pointsagreed with you Jason but for instance when it comes down to html rendering, should it be handled by express (+ jade) or angular?
jason chan
31,009 Pointswhat ever is easier or scalable.
jason chan
31,009 Pointsangular would be handling that. Angular would be faster.
Margee Bajpai
3,890 PointsThere are things which should be done server side (i.e. Express, not Angular), most notably user input validation - Angular, as it's client side, can be tampered.
Also, if you'll ever want to offer access type other than web app (i.e. mobile app), you'll probably need an API anyway - Express can do this, Angular don't.
Finally, database access - usually Angular app will need to connect to some kind of back-end to perform CRUD operations. You'll either go with hosted DB like FireBase, or you'll end up using your own database. Latter scenario is more popular and you'll need Express (or similar) for that.
Express and AngularJS do not mutually exclude one another, they serve different purpose - in fact it's perfectly fine to use both - express for all your serverside logic, and Angular for client side logic.
I hope that answers your question Thomas.
Jacky Chan
5,541 PointsBase on the replies, I think of a similar questions want to ask here.
Express vs Node.js, which one is better or for which situation correspondingly.
Thanks
jason chan
31,009 PointsDepending on project and what your trying to do. But angular if you want to create filters for like a shop like colors and sm, medium, and large for clothes.
Daniel Breen
14,943 PointsExpress is a Node framework. If you're using Express, you're also using Node. I'm no node expert, but I think what you're getting at is, "What Node framework should I use for my API/Back End if I have Angular running my Front End?"
I'd say that it depends on what you're trying to accomplish. Angular and Express have popularized the MEAN stack: Mongo, Express, Angular, and Node. Notice how both Node and Express are in that acronym?
We were using Restify at my former company because Express includes stuff for templating that we didn't need. In other words, Restify is great for simply creating endpoints for CRUD operations (Create/POST, Read/GET, Update/PUT, Delete/DELETE).
There are several other Node framworks too. Hapi, Loopback, and Sails to name a few.
So... the easiest answer to your question based on the assumption that you haven't worked with Node much: Pick the one that's the easiest for you to learn or the one that your boss tells you you're using. Even though Express is a little overkill, there are endless tutorials everywhere you look. I learned Restify first because my first job had implemented it before I got there, but I didn't really know how to read the documentation. It's there. I just was too green to understand the lingo. Later on I played around with Hapi. It was easier to do some things, and harder to do others.
Bruno Navarrete
Full Stack JavaScript Techdegree Graduate 22,246 PointsGreat comment Daniel Breen. Sometimes you forget most of he time the framework will end up choosing you thanks to external requirements (being new to the team for example).