Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

# Nodejs

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 authorization: basic ... header.

read more

Debugging with Node

posted in Nodejs on 2016-03-22   debugger step node text function program line run counter command

Node has a wonderful debugger. As a front-end developer I’m mainly using Chrome’s tools but sometimes I run things in Node environment and this native feature comes handy. In this article we’ll see how to debug in the terminal using Node’s debugger.

read more

Fun playing with npm, dependencies and postinstall script

posted in Nodejs on 2015-01-07   c module package json npm runme js node_modules b installed index dependencies

I like npm and the fact that I can install tons of stuff. It’s great piece of software and helps me solve problems everyday. Yesterday I had to use a postinstall script and hit a problem.

read more

Win Free Copies of my new book – Node.js Blueprints

posted in Nodejs on 2014-08-12   node js book array top winners writing users tmp var array current array

Readers would be pleased to know that I have teamed up with Packt Publishing to organize a Giveaway of a new book written by me - Node.js Blueprints. And three lucky winners stand a chance to win 3 e-copies of this book. Keep reading to find out how you can be one of the Lucky Winners.

read more

Node.js Blueprints book - second chapter's clarification

posted in Nodejs on 2014-07-30   express version book app chapter node js blueprints var bodyparser code

Before a couple of months my first book Node.js Blueprints was published by Packt. There are a couple of reviews in Amazon about chapter two. It’s about Express. One of the most popular frameworks in the Node.js ecosystem. The book mentions version 3.0 but the truth is that the code samples are for version 4.0. I feel that I still have to point out the differences and mark these parts of the chapter that are not valid for the newest version of the library.

read more

Developing Node.js applications with Google Chrome

posted in Nodejs on 2014-06-09   node js yez page git terminal browser chrome console url http var

Google Chrome is my favorite browser. I'm spending a big part of my working hours there, so it makes sense to use it for everything. Last week I posted "Sorry, Chrome killed the terminal". The article was about Yez!, an extension that brings terminal-liked functionalities to the browser. Today, I'll show you how I use Chrome in my Node.js development workflow.

read more

Node.js application made with Express and AbsurdJS

posted in Nodejs on 2014-06-07   html js function css express content styles absurdjs app

Node.js is one of those new technologies, which are attracting more and more developers every day. Mainly, because it's JavaScript driven, a lot of people are interested working with it. In this tutorial, I'll show you how to use AbsurdJS together with Express. Express is one of the popular Node.js frameworks. However, the other instrument is really fresh one and I hope that you will find it useful.

read more

Sorry, Chrome killed the terminal

posted in Nodejs on 2014-06-04   yez extension browser terminal node js chrome shell commands running task

That's right. I'm not using the terminal anymore. Instead of that I'm using Chrome. Yes, the Google's browser. There is an extension called Yez! that connects to a Node.js module via web socket. It executes the shell commands and returns the result. And even works under Windows.

read more

Node.js: managing child processes

posted in Nodejs on 2014-05-21   error stdout js exec console log stderr visits function var module

These days I spent some time working on Yez!. Chrome extension whose main role is to replace the annoying switching between the terminal and the browser. It uses Node.js module to run shell commands. So, I had to deal with child processes, and I decided to document my experience.

read more

No back-end blog solution with Node.js and Markdown

posted in Nodejs on 2014-04-22   articles techy md tags article blog html page sidebar content

Before a couple of weeks I published Techy. It's a flat CMS based on Node.js and Markdown. I made it because I wanted to write my articles in Markdown format and avoid the annoying publishing workflow which I'm using now. I feel that it's not very clear how Techy works and decided to create a simple blog illustrating the processes.

read more

Book review: Getting Started with Grunt: The JavaScript Task Runner

posted in Nodejs on 2014-04-21   book grunt experience free javascript task runner helpful started

I just finishing reading Getting Started with Grunt: The JavaScript Task Runner. The same book that we (I and Packt publishing) run a contest for. You could still joint it here and win a free copy.

read more

Using Node.js to rename set of images

posted in Nodejs on 2014-01-22   file processed path glob files fs require

Today I had to rename a bunch of image files to the same names, but in lower case. Here is how I did it.

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

Real time game with NodeJS and Socket.io

posted in Nodejs on 2013-05-13   user var function users socket io game data end clicks currentwidth

NodeJS gives me the ability to write back-end code in one of my favorite languages - JavaScript. It's the perfect technology for real time applications. In this tutorial I'll show you how to build a web chat with Socket.io.

read more

AssetsPack - a friend of the front-end developer (pack your assets with NodeJS)

posted in Nodejs on 2013-03-16   css js file assetspack pack tests data type packing html module

AssetsPack is a NodeJS module which helps in organization, compilation and minification of assets. It's meant to be used in local environment during the development process. It was made generally for HTML/CSS/JavaScript based applications.

read more

Catch uncaught Exception in Node.JS

posted in Nodejs on 2013-03-15   exception console log run

I'm working on a very simple tool which compiles some stuff. The big problem is that if I write something wrong I can't catch the exception from the compiler and the nodejs's process exists. Then I have to go back to the console and run the app again. That's of course not acceptable. Thankfully there is a workaround.

read more

Testing with headless browser (Zombie.js + Jasmine)

posted in Nodejs on 2012-10-14   browser function login site expect browser test testing input zombie css selectors

I was planning to post this article a few weeks ago, but today I finally finished the examples and I can't wait to share it. We all know that the testing is a big part of our daily tasks and we should use every existing tool to make our lives easier. I really like test driven development and once I found the concept of the headless browsing I started to think that we can automate every single aspect of the testing. In this post I'll show you how to use Nodejs to test a simple php site.

read more