Bill Gates’ infamous first rule for automation states that automation applied to an efficient operation will magnify the efficiency. When it comes to API design there have been many attempts at code generation, transpiling and scaffolding of REST apis, yet due to the nature of REST, it has lead us to his second rule for automation - automation applied to an inefficient operation will magnify the inefficiency.
GraphQL Compose is great example of automation done right in an efficient system. Together with the mongoose plugin, it is a powerhouse, the holy grail of API architecture for those looking to accelerate…
The cursor suggests dialog between man and machine. There is an expectation to interact. Like an old friend, the computer waits patiently for our entry at the communication point. It blinks, we enter some characters. It blinks again, we repeat. We search, we calculate, we navigate, we pour over results.
Over the years Inputs have gotten smarter. They remember, they finish our sentences. We can touch them with our finger. They can no longer be contained to a single box nor a single screen. …
I began the migration by installing the typescript parser and linter packages. Did…
This is the second installment in my series on implementing image uploads with React Native. In my previous article, we created a custom image picker and an upload progress component.
I now want to go over the upload service (thunk action creator) and how to communicate with our nodejs api using Axios. I’m using Redux for state management and Redux Thunk which is great for creating async services that allow you to dispatch multiple action creators, async or not. To clarify I’m calling the thunk methods services because technically action creators should return an object, so I will refer…
Whether you’re building web or native applications, you’ll eventually be tasked with implementing a file uploader and in pursuit of the perfect solution. File uploads have a lot of moving parts. You have file pickers, progress bars, spinner icons, APIs that send progress back to the user with sockets or hooks, etc. Developers often resort to using pre-built components that are not very customizable. For example, React native gives us a pre-built image picker component. I wanted to modify it to use a dark theme but to my surprise, the background color cannot be changed. I decided to roll my…
In this article, I’m going to turn a login screen with no styles to a fully styled view, based on the inVision Studio mockup above. Using this approach, it's guaranteed to make your react native application more manageable, and your styles, reusable.
This is what we’re starting out with:
In part one of this article, I went over some basics of unit testing and why I chose Mocha as a testing framework. In part 2 let’s get started with setting up our testing environment.
Install Mocha, Chai, Supertest
npm install mocha --save
npm install chai --save
npm install supertest --save
Configure your package.json file so that the npm test command works:
"start": "node index.js",
"server": "nodemon index.js",
"db": "mongod --dbpath /usr/local/var/mongodb/ --rest"
When you install mocha locally, npm adds a mocha executable inside node_modules/.bin/
Now create a directory called ‘test’ in your document root…
In my previous article, we covered unit testing front end react native applications using Detox. I would like to continue on the subject of unit testing but for server side applications. In this article, I’m going to look into unit testing strategies for a nodejs CRUD API that is built on express and mongodb. My API currently has JWT authentication implemented along with a photo upload route that uploads an image to Amazon AWS.
The state of server-side js unit tests in 2019
Let’s look at some of the options available to us for testing node applications. A quick google…
If you practice Test Driven Development, or you want fully automated functional tests, Snapshot testing with Jest is insufficient. Let’s say you want to E2E test a login screen. Test Driven Development always begins with writing tests first followed by implementation of the functionality. So how would one go about writing an end to end test for a login screen? You have to imagine what a use case might be for the end user. We want to describe the login flow with simple key phrases. So for a login screen, the user will most likely see two inputs and a…
Redux Thunk is a popular middleware for React Redux. You can create services that return a function hence the name Thunk. The creators of Thunk call this function ‘action creators’. Here is a quote from GitHub:
“Redux Thunk middleware allows you to write action creators that return a function instead of an action.”
For me personally, it makes more sense to think of these thunk functions as services since they don’t return actions. Remember that actions are plain objects. Your thunk function will call dispatch, so you’ll be calling dispatch at least twice. Once from your component when you call…
Software Engineer. Blockchain Enthusiast. Street Photographer.