Babel F# pipeline operator

Introduction

Writing readable and declarative code in JavaScript, how nice it would be! šŸ˜†
I know, readable and declarative don’t go in the same sentence when talking about JavaScript, but should it be always like this? The community has been looking for ways to improve these problems with the language for years.

Since Babel 7.0 there have been a few proposals implemented that lean towards the readable and declarative JavaScript goal. I’m sure you have heard about the pipeline operator, but if you haven’t then it’s fine, this post will guide you through. This operator is syntactic sugar with the intention to make our code really sweet (pun intended). In this post I’m going to discuss one of the competing proposals, the F# variant.

Continue reading

Build a secure Angular client using ASP.NET Core and OAuth

What is the resource owner password credentials grant? How can I secure my Angular client using OAuth and JWT bearer tokens? In this post I will focus on the resource owner password credentials grant, a different kind of credential flow supported by the OAuth protocol, and how it can be used to secure certain resources on an Angular application. Similarly toĀ previous post, I will create the authorization server from scratch, then the resource server, a simple ASP.NET Core RESTful API, and finally the Angular 6 application, with all the bits and pieces required to prevent unauthorized access.

Continue reading

Migrating from typings to npm @types

Typescript definitions. What a confusing topic. Prior to Typescript 2.0 we were using tools likeĀ typingsĀ to manage and install them. After 2.0 we moved toĀ npm@types, but what does that really mean? And how can we migrate an existing project that uses typings? What about custom type definitions?

In this post I will show you how to migrate to newest @types, answering all these questions.
Continue reading

Loading JSON files with SystemJS module loader

I really hate this mess on JavaScript modules. We have AMD, CommonJS or UMD to support both. Then ES6 came into the game. But what about .json files on browser? There are different ways to load them and not all libraries support them! Your module loader should be sophisticated enough to handle this.

In this post, I am going to talk about SystemJS and how it simply loadsĀ files in the browser, other than .js files, like text or JSON, especially from third party modules, without driving you nuts!
Continue reading

Unit test code with Jasmine and code coverage with Karma coverage using Istanbul

Karma is an awesome testing environment, it is open source, it supports a plethora of testing frameworks and it is easy to use.

In this post I am going to create some simple tests, run them on Karma using Jasmine and finally, show some code coverage reports, through Karma coverage.

Continue reading