Skip to main content

Middlewares

Middlewares in Javascript are functions that come in the middle of the request-response cycle. They have access to both the request and the response object as well as the next middleware function to be executed; usually called next().


Popular examples on middleware include: body-parser, cors, session, cookie-seesion and cookie-parser.

Comments

Popular posts from this blog

Big O Notation

Big O Notation is a mathematical expression that describes how much time an algorithm takes to run according to the size of it's inputs; mostly concerned about the worst case scenario. Types: 1- Constant Time O(1): On this order, regardless of the number of items, the iterations(time) are constant. Example: const getFirstItem = items =>    items[0]; getFirstITem([1, 2, 3, 4]);  // 1 (one iteration) getFirstItem(['b', 'd', 'g']);   // 'b' (one iteration) 2- Linear Time O(n): On this order, the worst case grows with the number of items. Example: Javascript's built in function indexOf, it loops over an array to find the  correct index of the passed element. The worst case is looping over the whole array. [1, 2, 4, 9, 23, 12].indexOf(12); 3- Quadratic Time O(n ^ 2): For this order, the worst case time is the square of the number of inputs. It grows exponentially according to the number of inputs. Example: Using nested loo...

ES6 vs. ES5

ES stands Ecmascript which the standard that JavaScript was build on top of. ES5 was released in 2009 (ES2009) and ES6 was released in 2015(ES2015), so this means that it took the committee in charge 6 years to release an update to the language. That update was massive; mainly because version 4 was skipped. ES6 brings a lot of great features to Javascript that developers have been long waiting for.

My Experience in RBK

Before coming to RBK I thought that it would be a scary place for a person like me, totally different environment unlike anything I have ever experienced. I was correct about the second part, but for the first part; definitely no. I didn't think that I will be able to pass the admission process or even meet the expectations of the admission staff for my progress and assigned tasks. However surprisingly, I made it! I was one among other 40 or so students to be part of cohort 5. I was the happiest person on earth once I received that phone call from Zainab; she was the one that brought me the good news. I'm gonna keep this memory for a lifetime. One of the expectations I had before attending the prep was that we cohort 5 will be hacking/studying at King Hussein Business Park , which was a disappointment for me; because I have seen the pictures on RBK's social media for previous cohorts. I have learned a lot in these past four months, more than I could learn on my own f...