-
The simplest HTTP proxy with custom headers
posted in Nodejs on 2020-05-06 proxy headers authorization node local request server req http basic pass -
These days I had an interesting problem to solve. At work, on our staging environment, we have basic authorization. It works really well but for some older versions of Chrome we experienced a weird issue. The browser did not pass the authorization header. The app runs fine but as soon as it does a fetch request to a local endpoint the request fails with 401 not-authorized error. In the modern browsers that's not happening because the browser kinda knows that we came here with basic auth and automatically includes
read moreauthorization: basic ...
header.
-
Rethinking the Redux API
posted in JavaScript on 2019-09-10 redux const state login username password authenticated action function reducer -
I really like Redux. I Love its ideas. The reducers for example - small pure functions that apply changes without side effects are nice way to model the mutations in the state. Redux also teaches us to use the one-direction data flow which makes our apps more predictable and stable. These two things fits well for what we are doing on the front-end - building user interfaces.
Of course there is nothing perfect and Redux as every other library has its own problems. In this article I want to explore some ideas for new APIs that will help solving the problems that I encounter. I’ll be happy to see your comments below.
read more
-
How require/import may decrease your testability
posted in JavaScript on 2015-08-23 login http js function var module password username login js user promise -
When CommonJS was announced we all thought “Finally something that will organize our code”. However, there are some cons that we should be aware of. It’s not only unicorns and rainbows. In this article we will see how a simple
read morerequire
line makes our code difficult to test.
-
Unit test your client-side JavaScript
posted in JavaScript on 2014-11-20 var register test function message password username js directive jsdom angularjs -
I don’t think that we have to discuss the importance of having tests. That’s not something that we add to the project in addition. That’s something that the project is based on. And because testing is so important we have bunch of tools in our disposal. We all know (I hope) how to test our back-end code. However, once we move to the front-end is a bit different. At the moment we are working on a big single page application and testing is one of our main focuses. In this article you will see how to unit test our client-side JavaScript.
read more
-
SASS and Gruntjs (Node.js setting up)
posted in Nodejs on 2014-01-14 grunt sass compass css add based gruntjs grunt contrib compass -
I'm writing a lot of JavaScript these days. Even if the project is not Node.js based I'm using it for processing some tasks. At the moment most of my projects use GruntJS. Today I spend some time adding SASS to my workflow.
read more
-
Basic PHP authentication
posted in PHP on 2011-10-17 php_auth_pw php_auth_user password username works -
The .htaccess file is actually a possible solution for this purpose. The problem with this approach is that the value of AuthUserFile should contain an absolute path. It also works with relative paths, but it is relative based on ServerRoot, which in most of the cases is different from DocumentRoot. I also didn't want to deal with sessions or cookies and after a short research I found the answer.
read more