I am using axios to scrape some data from some websites. Currently, I hit the case where the encoding of the website is in windows-1251 and the response I got from the request wasn’t readable at all.
Continue reading “Parse windows-1251 (cyrillic) request in axios”Tag: NodeJS
Feature toggles in NodeJS
I had to implement a feature toggle recently.
What is a feature toggle?
I will keep it short. You have to add a new feature to your product, but you want that feature to be available only for certain type of users. What you do? Well, you just make an if check to see the user can see this feature and then you toggle it for him. Here is a sample check:
if(ToggleRouter.isEnabled("comments")) { // Display the feature to the user }Continue reading “Feature toggles in NodeJS”
Simple role management for SailsJS
You have probably heard this form me. I am working on a Sails js project and I wanted to implement a simple role management. That means that I have several routes like: “/admin”, “/login”, “/users” and I want the admin route to be accessed only from admins, login to be accessed from admin and users and the users route to be accessed from only the users.
Continue reading “Simple role management for SailsJS”How to add Joi params, query, body validation to Sails JS?
Let’s keep the things short. I am working on a SailsJS app and I am missing a lot the HapiJS Joi validation features. It keeps the validation logic separate and isolated from the controllers and other stuff. So I was wondering how to integrate Joi with Sails.
Continue reading “How to add Joi params, query, body validation to Sails JS?”Let’s hook up Socket.IO with HapiJS in a single code base
So we wanted to integrate a websockets server within our REST api for which we were using HapiJS. I was previously using Socket.IO solution for websockets and I was very happy with it. So we decided to use it with our REST server in a single codebase.
Continue reading “Let’s hook up Socket.IO with HapiJS in a single code base”