background preloader


Facebook Twitter

Architecting a Secure RESTful Node.js app. Express4 + Mongoose + JSON Web Token Authentication - Warehouse. Authentication is part of almost every system, even if it is in node.js, Express, Angular.JS, PHP, Perl, Ruby, or any other languages you are using.

Express4 + Mongoose + JSON Web Token Authentication - Warehouse

Dealing with authentication is a must for most of the systems. This article is quite long, so be prepared. Table of contents Tutorial Resources How we used to do authentication As we know HTTP protocol is stateless, so it cannot remember anything between requests, as it forgets everything on the next request. Tutorial: Building a data-driven SVG map with AngularJS. Let’s Angularize this map..

Tutorial: Building a data-driven SVG map with AngularJS

In order to get the map to react to the data, the sections of the map need to be integrated into Angular somehow. We can do this with a directive for each region: We could reference the directive in the SVG like so: This sucks though for 2 reasons: Firstly it adds non standard mark-up to our SVG file and secondly and even more importantly it’s bloody tedious! Instead, let’s inject the directive into the DOM with Angular.

Edit our directives thus: Lazy Loading In AngularJS. When building large sites or apps with many routes/views in AngularJS, it would be good to not have to load all artefacts such as controllers, directives etc., on the first load.

Lazy Loading In AngularJS

Ideally, on first load, only the artefacts that are needed for the route in question, will be loaded. This may be either in one download or multiple depending on the app, however, it will only be what is needed to render the particular route. Then as the user navigates the app by changing the route, other artefacts that have not already been loaded, will then be loaded as and when there are needed.

Not only should this potential speed up the initial page load, but it should also result in bandwidth not being wasted. With this post, my aim is to show how the lazy loading of artefacts such as controllers and directives can be achieved with AngularJS. How can lazy artefacts be registered against a module after the application has already been bootstrapped? Angular Best Practice for App Structure (Public) 5 Guidelines For Avoiding Scope Soup in Angular - Techno Fattie.

Today I was answering a question on Stackoverflow about Angular.js The more I dug into this person's particular problem the more help I realized they needed.

5 Guidelines For Avoiding Scope Soup in Angular - Techno Fattie

They were admittedly an Angular noob, but making a pretty decent effort by getting their hands dirty. A+ for effort. I ended up completely refactoring their code, but I see these same kinds of problems over and over again so I decided to compile some of these guidelines into a blog post for future reference. If you are impatient, here is the original code, and here is the refactored version. The Dynamic Programmer - Hernan Garcia : Using includes with Angular.js to organize your UI modules.

If you are writing any non trivial web application you will surely notice that using a single view for your main page doesn’t allow for a good separation of concerns.

The Dynamic Programmer - Hernan Garcia : Using includes with Angular.js to organize your UI modules.

Most screens will deal with a few concerns, specially if our application wants to provide some notification area or summary information. Everything you need to understand to start with AngularJS. Build custom directives with AngularJS. A Step-by-Step Guide to Your First AngularJS App (with code) What is AngularJS?

A Step-by-Step Guide to Your First AngularJS App (with code)

AngularJS is a JavaScript MVC framework developed by Google that lets you build well structured, easily testable, and maintainable front-end applications. And Why Should I Use It? If you haven’t tried AngularJS yet, you’re missing out. The framework consists of a tightly integrated toolset that will help you build well structured, rich client-side applications in a modular fashion—with less code and more flexibility. AngularJS extends HTML by providing directives that add functionality to your markup and allow you to create powerful dynamic templates. It also implements two-way data binding, connecting your HTML (views) to your JavaScript objects (models) seamlessly. Angular provides services on top of XHR that dramatically simplify your code and allow you to abstract API calls into reusable services.

Finally, I love Angular because of its flexibility regarding server communication. So, Where Do I Begin? First, let’s decide the nature of the app we want to build. Angular.js : Advanced Design Patterns and Best Practices. Code Organization in Large AngularJS and JavaScript Applications — Cliff Meyers. Many developers struggle with how to organize an application's code base once it grows in size.

Code Organization in Large AngularJS and JavaScript Applications — Cliff Meyers

I've seen this recently in AngularJS and JavaScript applications but historically it's been a problem across all technologies including many Java and Flex apps I've worked on in the past. The general trend is an obsession with organizing things by type. It bears a striking resemblance to the way people organize their clothing. Let's take a look at angular-seed, the official starting point for AngularJS apps. The "app" directory contains the following structure:

AngularJS and scope.$apply. If you’ve written a non-trivial amount of code in AngularJS, you may have come across the $scope.

AngularJS and scope.$apply

How AngularJS Embraced Traditional Design Patterns.