-
Reinventing the routing in React apps
posted in JavaScript on 2021-01-18 router react navigo -
The router is the backbone of your application. Trust me, that's how it is and I can prove it. One of the fundamental ideas in Web is the URL (Uniform Resource Locator). Or the way of how we very often call it - "web address". No mather what you are building there is a web address which identifies your resource. The router is the front office that accepts the request to particular URL and wires it to a logic. Logic for generating HTML or JSON response or something else. So, the router is very important part of your system.
At the end of last year I rewrote one of my favorite projects - a vanilla JS router called Navigo. I was procrastinating this work for years. Finally I did it in TypeScript and wrote 100+ unit tests along the way. This refactoring opens the door for new features and more importantly, for integrating the library into other places. Like React for example.
read more
-
Deep dive into client-side routing
posted in JavaScript on 2016-01-03 router javascript navigo routing -
(This blog post is inspired by A modern JavaScript router in 100 lines and heavily related to Navigo router project)
If you build single page applications you probably know that one of the must-have parts is the router. The bit that knows how to tweak the content of the address bar and notifies the rest of the system for URL changes. In this article we will discuss the various aspects of the routing in the browser.
read more
-
Hacking a weird failing HTTP request
posted in Architecture on 2015-12-04 request nginx server st http router problem external api -
I recently finished watching Mr. Robot. If you didn’t check out the show please do. Last few days I felt like I’m hacking something. Just like Elliot in MR. Robot. This blog post is about fixing a weird bug. Really strange problem with a failing HTTP request.
read more
-
A modern JavaScript router in 100 lines
posted in JavaScript on 2014-02-21 router javascript navigo match history node -
(The router here is now placed in its own project - Navigo. There is also another article Deep dive into client-side routing which you may find interesting)
Nowadays the popular single page applications are everywhere. Having such application means that you need a solid routing mechanism. Frameworks like Emberjs are truly build on top of a Router class. I'm still not sure that this is a concept which I like, but I'm absolutely sure that AbsurdJS should have a build-in Router. And, as with everything in this little library, it should be small, simple class. Let's see how such a module may look like.
read more
-
Dependency injection in JavaScript
posted in JavaScript on 2014-01-06 function var dependencies router service scope arguments deps dosomething -
I like the quote that the programming is all about managing complexity. Maybe you've heard that the computer world is a giant construction of abstractions. We simply wrap things and produce new tools over and over again. Just think for a minute. The languages which you use have build-in functionalities and they are probably abstracted functions of other low level operations. It's the same with JavaScript.
read more