Lesson 16

Setting up the Server

Creating the real server for the application

PRO

Lesson Outline

Setting up the Server

With the theory of the last two lessons out of the way, we now have all the knowledge we need to finish off the rest of the tests for our application. Now we are going to focus on one of the more complex requirements that we had for the application.

  • A user should only be able to log in to the application with a valid license key from SendOwl

In order to implement this requirement, we will need to create a unit test for a service that handles checking a license key against a server - which isn't a problem because we know how to create a mocked backend now. As we know, a unit test by itself is not enough - we will also need to implement an E2E test for this functionality. When running our E2E test we will not be mocking the backend, we will be hitting the real server.

Of course, that means we need a server to handle the request! The purpose of this module is not to get into details about how to create a a backend server for an application, so we are going to keep this as simple as possible. We are going to create a simple server with Node and Express that will just return us a "passing" response for any request we make to it. Definitely do not use this as an example of how to create a modern NodeJS server - we won't be using any modern tooling at all, it is literally just going to be a plain JavaScript file.

The specific integration with SendOwl is not really important. However, if you are interested in how that integration works I will be leaving the code for that in the server setup - it will just be commented out. If you want to actually set up the integration with SendOwl you would need to create your own SendOwl account and set up a product that you want to sell.

PRO

Thanks for checking out the preview of this lesson!

You do not have the appropriate membership to view the full lesson. If you would like full access to this module you can view membership options (or log in if you are already have an appropriate membership).