Object Initialization and Constructor

When we have few fields in a class and want to initialize every field in a constructor it should become a little bit messy and maybe we need a few constructors. public class User { public string Name; public List<string> Roles; public User(string name) { Name = name; } public User(string name, List<string> roles) {…

Code coverage in 2 minutes with NYC

In my previous posts about testing, I don’t have a clear picture of how much of my code is protected with tests? NYC comes to help me know the real status of my testing. NYC is an npm package for getting stats about the test coverage working hand to hand with Mocha and the setup is so…

Testing promises with Mocha.

In my post about testing with Mocha, I forget a common task in every javascript developer, “the promises”, it is a common task for making our code run async, but how I can test it ?. Feel free to read the code on Github or continue reading. I will write a method that returns a promise and we will…

How to Test javascript from 0 to Mocha

I’m trying to learn to test in javascript, today we have few ways to test our code write plain test code or using mocha, jest or cypress. But what is a Test? the test is a piece of code that ensures our software works as we expect, it can be done without frameworks. Feel free…

Create API with AWS API Gateway and Serverless Framework

Serverless is framework is one of the most widely adopted frameworks for build serverless applications, you can build great solutions for Azure, AWS or Google Cloud, in my case, I will use AWS. To start is so easy, first, we install the serverless node package and configure it with AWS. Configure Serverless Framework with AWS…

React Router in 3 minutes

Implement routing into a React app is so easy, the first step is to install react-router -dom package. npm i react-router-dom In the App.js import 3 essentials elements BrowserRouter, Route and Switch from react-router-dom, these handle our routes, create links and load components. import { BrowserRouter as Router, Route, Switch } from “react-router-dom”; Every one…

Gatsby, StaticQuery, and PageQuery part 3

Today is my 3rd day with Gatsby, if you read my previous post about GraphQL, I had a pending task bind the data from GraphQL using StaticQuery component and query in Pages. StaticQuery is used to connect our components with GraphQL, it can wrap all component and bring access to the query result. Page Query is const with the GraphQl…

Graphql and Gatsby part 2

I found that Gatsby uses GraphQL for sending data through to components, that means that understanding how GraphQL works in Gatsby is a must. Gatsby comes with a GraphQL’s web IDE for executing and testing our queries. When we run gatsby develop, this runs an instance of GraphQL IDE at http://localhost:8000/___graphql. You can also use this…

Starting with Gatsby part1

Gatsby as a React GraphQL and static site generator with easy development and amazing fast finish product that allows delivering faster websites. It comes with React, React Router, Webpack, Graphql and also it takes care of service workers, server-side rendering, code splitting, image loading and more. I’m motivated to start learning Gatsby and to use…

How to Install all your apps with Brew + Cask

I hate to do boring tasks, like install every app for my machine it is a bored and large process, you can create a script and let Brew and Cask work for you. Brew The Brew is a great package manager for OSX. He is the principal actor in our movie. Run the next command from the…