Coder Thoughts Piotr Mionskowski's thoughts on software, technology, architecture, design patterns and programming in general.

Piotr Mionskowski

  • Curl and a missing slash

    24 February 2014 http, node.js, https, and proxy

    While I was playing around with proxy-mirror I noticed an interesting behaviour when testing the proxy with curl. The following command:

  • An HTTPS system proxy with node

    03 January 2014 http, node.js, https, and proxy

    Creating a simple http proxy in node.js is super easy thanks to an excellent module – http-proxy. With only the following code you’ll have a proxy that can be used as system or browser level proxy: ``` var httpProxy = require('http-proxy'); var proxyServer = httpProxy.createServer(function (req,res,proxy) { var hostNameHeader = req.headers.host, hostAndPort = hostNameHeader.split(':'), host = hostAndPort[0], port = parseInt(hostAndPort[1]) || 80; proxy.proxyRequest(req,res, { host: host, port: port }); }); proxyServer.listen(8888); ```

  • Building an HTTP sniffer with node.js

    01 January 2014 javascript, http, angularjs, node.js, express.js, https, and proxy

    Whether to inspect a server response, optimize network usage or just to fiddle with new REST API it almost always make sense to use an application that can display http requests and responses for investigation. On Windows there is the great Fiddler. While it’s possible to use Fiddler on other platforms using virtualization software I think it’s an overkill. Fortunately there are alternatives. Charles looks like the most advanced one offering most if not all features available in Fiddler. There is also a little less popular HTTP Scoop. Both Charles and HTTP Scoop aren’t free but in my opinion they are worth the price especially if used often. Command line lovers might find mitmproxy suit their needs. If you only need basic features ngrok might serve you well. To dive a bit deeper and see http traffic on a tcp level WireShark is indispensable. As you can see there are plenty of tools available to help understand what is happening on http level. As I was learning about http cachi...

  • Combine Express.js and ASP.NET Web API

    03 November 2013 node.js, express.js, OWIN, and asp.net web api

    I’m really excited about the OWIN initiative. This “standard” enables countless new ways of combining existing http web stacks with .net – a thing that up until recently was either impossible or not feasible. It gets even more positive knowing that Microsoft supports the case actively.

  • Backbone – when used properly…

    27 October 2013 javascript and mvc

    ...it keeps one’s head out of one’s butt. This little gem was the first JavaScript MVC like tool that caught my eye. It has a very vibrant community and seems to have reached certain maturity level. More importantly it is so small library that everyone can grok its source code fully in couple of hours. And yet I haven’t actually used it in any project even thought I had couple of occasions. I guess it was partially because I had read ThoughtWorks technology radar October 2012 edition where author’s claim that: Backbone.js is a great example of an abstraction pushed too far (…) We find that it blurs the framework and model too much, forcing either bad architectural decisions or elaborate framework hackery in order to preserve sanity. Back then I had to make a quick decision which framework/library to use, if any, on a project that I started working on and the article steered my away from using Backbone.js. Just for the record the project was developed with A...

  • AngularJs modules to the rescue

    16 September 2013 javascript and angularjs

    Building large scale JavaScript application is a tough problem. The language nature is malleable and it does not have proper modules mechanism built in. Some argue that you can’t really built and maintain big applications built with JavaScript.  Others say that the key in succeeding is to never built big applications but to approach things in a more clever way – by applying divide and conquer rule.

  • AngularJs – my new superhero tool.

    15 September 2013 javascript, mvvm, angularjs, and mvc

    As I mentioned in my previous post I’ll describe my thoughts and findings about 3 popular JavaScript libraries that help building large web application. I’ll start with AngularJs which is the first one I’ve used in a real product.

  • Javascript MV* frameworks

    16 August 2013 javascript, mvvm, and mvc

    Building a web application today isn’t nearly as hard as it was couple of years ago. Back then creating a rich client application using HTML and JS was possible but the number of options you had is a fraction of what is available today. The first SPAI helped building was relatively simple project –built with ExtJs library when it was still in version 2. There were of course other options like dojo but with our team’s little experience in web technology ExtJs seemed like a better choice solely because of its superior support. Shortly after I worked on another web application built with Web Forms and jQuery.  We finished both projects, they worked on most browsers but we didn’t avoid creating a mess in JavaScript. Presentation logic was mixed with business rules scattered through event handlers inside unstructured components source code. Just to be fair it definitely was not caused by the frameworks we used but because of our lack of knowledge and experience.  I guess that h...

  • URL Rewrite problem with POST request

    31 July 2013 URL Rewrite, asp.net, and Glimpse

    Greetings Hello Everyone! In this blog I would like to share my thoughts and findings on programming, software and a like. I will post here so that I can improve my writing skills and find stuff I was working on previously easier. URL Rewrite IIS users had waited a bit for Apache equivalent of mod_rewrite. Finally we've got a decent module from Microsoft - Url Rewrite. Among basic features as rewriting all URLs to extension-less equivalents, blocking unwanted URLs or even more common providing friendly URLs the module provides a nice GUI inside IIS Manager so you can quickly test you ideas without referring to documentation. More importantly rewrite rules of your web site can be configured through Web.config configuration section. The feature I like the most is the ability to create a reversed proxy inside an IIS web site with a little help of another IIS module - Application Request Routing. I have used it couple of times, mostly to be able to make "cross...