Spring Boot with Kotlin bundled with a React application as a single deployable actifact.

In this post we will cover a simple way to get started with developing a full-stack application using Spring Boot 2 with Kotlin, that builds and bundles a React-application and serves it statically. The react application will use create-react-app for a painful way to setup and develop a SPA (single page application).

This post will be very beginner-friendly.

The main points of interest will be:

  1. Spring Initializr to set up a gradle project
  2. Creating a module structure
  3. Making them talk together
  4. Packing it all together
  5. Adding Spek for our backend tests

tl;dr: You’re not interested in the details and you just want to get started? Clone this repo and get coding, and disregard the rest of this blog post.

Read More

Simple guide to creating and publishing npm modules.

When I was first looking into publishing npm modules I was a bit overwhelmed with where to start, and I had a few misconceptions. I always thought that “I had to write ES5 code” and that “everyone is watching you and laughing at your mistakes”. Turns out it’s really simple, and surprisingly quick to do! This post will be covering creating a React component, but if you want to create a plain old JavaScript module you can follow the exact same exact steps. We will be using Rollup for writing ES6 code, but letting us distribute ES5 code.

The 8 steps to publishing a npm module are:

  1. Creating a distributable module using Rollup
  2. Publishing it to npm
  3. Oh.. I guess that’s it.

Read More

Unit testing React components, 5 basic techniques

This post will go through a few simple techniques that are great to know when you are testing your React components.

What packages will be used, and what do they do.

  • Jest: Jest is a test runner, it will execute our tests and provide some utility for spying and stubbing functions.
  • enzyme: Testing utility for React components to help us assert, manipulate and traverse our components.

If you want to get a project up and running to try these things just use create-react-app and add enzyme to it.

Read More