SSE, which stands for Server-Sent Events, is a quite nice way of simplex data transfer from server to clients, at server’s will. This avoids repetitive polling by the clients or unnecessary full-duplex web sockets. Typical SSE use cases include, news updates, social media feeds, stock price changes, etc.

Diagram of Data flow in SSE

In this discussion we will see how we can implement a simple SSE using just NodeJS. I feel like I can express it better without a library.

We will implement a simple News service. Which will eventually run out of news, and we will notify the client about it. …

I have read about fibonacci series, I have read about memoization, and also I have read about how to optimize fibonacci series with memoization. That’s it. I have read about them, but time has come to see if it really works, so original.

What is fibonacci ? Why should we bother ?
There you go.

What is memoization? Do we need to know?
What would we do without wikipedia!

Ah, finally, let’s see how much benefit we are getting using memoization while calculating fibonacci number

Note: In general, the time complexity of generating Nth fibonacci number
is O(2^N), but using memoization it comes down to O(N), of course with the space complexity of O(N), but it’s a sweet deal. …

Everything should be made as simple as possible, but not simpler

Albert Einstein

I have always wondered how to perform front-end routing in a single page application. Finally I got my answer from the History API. Here I am going to show what I did to achieve a front-end routing.

First of all, design the end-user API that is going to be consumed.

A nice example of using render props
A nice example of using render props
A call to changePath with a pathname will render the respective component

Now, lets define the consumption of changePath in those components.

Parnab Sanyal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store