One common requirement in web applications is keeping track of the currently logged in user throughout the execution of a request. While this is fairly simple to do in web servers where each request has its own execution environment (be it a thread or a process), Node's single-process single-thread model makes it less straightforward - but it can be achieved with the help of
In the process of finishing up an Express project, I wanted to leave a nice set of documentation for future users and/or maintainers of the API. I wanted the documentation to live next to the code, and the tooling to generate a nice site from it. Finally I settled for Swagger and used a combination of packages to get the job done.
One of my most recents tasks was to add some sort of user authentication to an API built with Express running on an embedded device. I'm used to working either with Rails, where these kind of things are mostly provided by gems that make all the decisions for you; or on small Node projects which didn't require authentication at all. So this was new and required me to do some research about alternatives and implementation details.
Telegram, for those who don't know it, is a free multi-platform messaging app.
Short story: PhantomJS considers a syntax error when a named function expression is called the same as some of its parameters, and won't be very explicit about it.
These are a couple of ways of constructing a layout that consist of a fixed footer, header, and sidebar. The application we were building had a preview to the left and the fixed sidebar to the right to tweak that preview. The problem to solve is how to give the sidebar the proper height so it will scroll its content correctly.
I fought against this for most of last week so now that I solved it I figured I could share it with the rest of the world (not that I had much fun running tons of Jenkins' builds to see if it was fixed...).
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.