Posts
Zod
tl;dr
TypeScript is already a great upgrade from JavaScript if you like types and want to ensure type-safety in your code base. Zod aids that goal by making sure that incoming data satisfies the purpose it is about to fulfill, among other features of course.
Zod is a TypeScript-first schema declaration and validation library with lots of features that I have yet to use. However, the basics are very handy and simple to get started with!
Posts
Integration Test Api in .Net Using Reflection
There are a few different approaches to testing in the spectrum between simple unit tests and complete E2E tests. If I had to choose one approach to prioritize I would pick integration tests.
The key reasons are:
Tests a flow of multiple functions, in contrast with unit tests where only a single function is tested Self contained i.e. the test has no external dependencies on a deployed environment etc. Makes logical sense to test a complete function in a REST api, a single Lambda in AWS or an Azure function The problem In my case the goal was to setup a test suite for a .
Posts
Mitigating Primitive Obsession in ASP.NET Web Api
One of the projects we work with at Devies is related to the dental domain. In that project we use the dental notation (ISO 3950) to refer to teeth. Every tooth have an unique identifier that consist of two characters. The first character represent a quadrant (one of four areas in the mouth). The second character is an identifier that refers to one of the eight teeth in that area.
Posts
Conventional Commits and Generating Changelogs
Documentation, while in many cases important, might not be the first thing you as a developer want to spend time on doing. Something you might do like as a developer is to spend a lot of time automating simple but tedious tasks in order to never have to do it manually again! With documentation being a particularly important part in our project we were extra keen on finding as many ways of automating documentation as possible.
Posts
.NET 6 Surprises
A few weeks ago, we upgraded one of our projects from .NET 5 to .NET 6, since .NET 5 was nearing end of support. In this process, we ran into a few hurdles. This post will go through a few of them that were a bit unexpected, and why we ran into them.
AccessTokenValidation deprecated This isn’t completely related to .NET 6 in itself, but we ran into the issue during the upgrade.
Posts
The kubectl wait Command
Last week, while writing end-to-end tests for our Kubernetes application, we discovered a useful Kubernetes command. Namely, the kubectl wait command. We managed to stabilize our test using this command, and we will explain how we did it in this post.
We have written our end-to-end tests in bash, and they deploy and manage different Kubernetes resources. Bash scripts execute commands sequentially, waiting for the first to finish before executing the next one.
Posts
Trick your local web server using the Host header
TLDR: If you need to “trick” a local web server that you’re making requests to a certain domain, but do not want (or have permissions) to modify /etc/hosts - Set the intended domain in the Host request header instead.
We are currently working on a project where we have an nginx instance that is redirecting traffic for many different domains. In our case, the nginx is an ingress controller in a kubernetes cluster, but you might use a similar approach if you’re hosting multiple websites on the same webserver.
Posts
We Got Cached 😱
For the past couple of weeks, we’ve been working on a React app from scratch. Additionally, we’ve added pipelines in Azure as an attempt to achieve MAXIMUM EFFICIENCY when it comes to deployment and integration. So there we are. It’s a lovely morning. The sun is shining, the coffee is warm, and we’re ready to drop some lines of code! 😎
Last week we built and deployed a version of our React app that had a slightly faulty CSS attribute that made the header of the app take up the whole screen.
Posts
Why you should add a cypress test to your CI/CD pipeline
Cypress is a framework for testing web applications, primarily used for end-to-end testing. In an end-to-end test you test your application as a whole just as a real user would, by interacting with GUI components, without any mocked components. The goal of this post is to convince you to add a single simple cypress test to your CI/CD pipeline.
In end-to-end tests with cypress you can test a lot of aspects of your application with very little test code.
Posts
Better Terminal Experience for Git and Kubernetes
When working on a project that uses git, it is essential to checkout the correct branch. You don’t want to realize after a few hours of work that you worked on the wrong branch and have a few messy merges and rebases in front of you. Of course, the easiest way to show the current branch is to run git status but that requires an action from you, Instead, I recommend you to include the git branch as part of your prompt string.