DevNexus 2017 Advanced TypeScript Breakout
This repository contains the source code for the Advanced TypeScript breakout session at DevNexus 2017.
Each folder contains the previous step's completed code. In other words, the code in each folder is what your code should look like once the necessary changes from the previous step have been made. For example, the
Step 2 folder contains all of the code changes outlined in
Step 1 (
Step 2 is a completed version of
Step 1's instructions).
The objective(s) of each folder are outlined below.
The starter folder contains a basic Node.js express server that serves a simple Angular 2 application. The Angular 2 application queries data from an API exposed by the Node.js application; the data returned by the API is hard-coded. The objective of this folder is to simply get familiar with the application.
Step 1. Add Unit Tests to server.js
In this step, we add unit tests to the express application to begin our server-side testing.
Step 2. Add Unit Tests to the API and Data Repository
The purpose of this step is to add Mocha unit tests to the Node.js API and the data repository.
Step 3. A Little House Cleaning
Step 4. Convert server.js to TypeScript
Now that unit tests have been added to the Node.js application, we'll begin coverting the application to TypeScript. The first refactoring is the express application.
Step 5. Convert API and Data Repository to TypeScript
Step 6. Create Second Repository (XML) and Add Unit Tests
We'll start by properly creating our unit tests to test a secondary repository. We will then create the secondary 'repository' that contains the data in an XML file to mimic a different repository type.
Step 7. Add Dependency Injection and Refactor
Step 8. Bonus: Add Named Dependencies
As a bonus, we'll add the capability to dynamically switch between repositories via the URL.