Behance is an online portfolios website. Here a user can create and see his/her/others portfolios. node-behance-api is an utility wrapper built on node.js for Adobe Behance rest services. This utility is developed for node.js only. Currently it supports most of the API's of Adobe Behance. You can upgrade or add other new API's via...
Introduction To Mocha Recently I have started learning MochaJs for unit testing of my NodeJs application. Although http://mochajs.org/ is very well documented and refine in its own. But that is most respect to Mocha itself. I tried and created lots of example so that it can relate to NodeJs. Before starting further, Clone/download...
One of the best practices of Automation testing is to leave the system from the state where you started your test from. While doing functional testing for an angularjs application using Protractor and Cucumber (BDD framework), there was a need to clean up whatever data was being generated in the Data setup (generally the Given) of the...
In the previous blog on Handlebars, we learnt the basic concept of handlebars and how to use them in your web applications. Now we will extend our knowledge, a bit more and see how we can use and create helper methods in handlebars to have more flexibility on data. Predefined/Built-in Helper methods: There are a number of built in...
Lets start with a basic find query in mongoose and observe its execution time. [js] Event.find({'schedule.closing': {'$gte': +new Date()}}, {}, {limit:20, skip:0} ).exec(function (err, events){ ........ ........ } ); [/js] In my last project on Nodejs, I have used the above query to fetch the events...
JavaScript is language for Ninjas some time mistake happens by Ninja also which slow down our Node Application, because unknowingly we are dynamically creating the property on GLOBAL objects or some time we get stuck in some closure issue's which are not easy to trace and becomes a memory leak for the application. These are the common...
Ever wondered that the most time consuming tasks are the one you have done numerous times on numerous projects, and why the hell am i doing it again? The most basic of examples of this is Scaffolding an app, you have to do a lot of things, repetitive things to get the app structure up to speed. This is an even bigger problem with...
Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: ⇒ Identifying...
Let us take a very common use-case: "There will be a registration page for users, where users will provide their required details along with their picture”. Details would be saved to MongoDB while the pictures would be uploaded to Cloudinary or S3 with user unique id." Suppose we have User Schema as given below: [js] /* * Schema...
In our node js application, sometimes we have to execute functions either synchronously or asynchronously. To achieve so , we have a node js module "async" that helps us to push down our functions in an array, so that we can execute them as per the need of the project. Installation Part: Run this command to install the "async" module...
In one of our Node.js projects, we used Mongoose module to interact with MongoDB. Mongoose provides us four types of built-in validation on schema as below: 1. Required: We can mark a field as required, which must be provided. 2. Limit: If field is type of Number in Schema, then we can restrict maximum and minimum value for that...
Many a times, we face a requirement where we need only one object of a class to communicate across the application. Singleton Pattern comes into role in this scenario. Singleton is one of my favorite Design Patterns. Singleton pattern restricts us to initialize more than one object. We implement Singleton by creating a class, having a...