Quick Start to using Typescript in Node.js applications

Quick Start to using Typescript in Node.js applications

Cut to the chase and quickly learn how to use TypeScript in Node.js applications. TypeScript is quickly gaining in popularity in the JavaScript ecosystem. It is strongly encouraged that those developing larger applications in JavaScript to use TypeScript.This book will quickly familiarize you with both TypeScript, and using TypeScript in Node.js application development.We'll take a simple example, a hypothetical CRUD-style database application, and implement both the database layer and the user interface. We'll use TypeScript in Node.js for the database interface (using the TypeORM library) and in Express code to drive the user interface. Along the way discuss how TypeScript is helping the coder to write better code.TypeScript brings strong typing and many other good features to JavaScript. Throughout its history JavaScript has lacked strong types, meaning that programmers must be extra careful in order to avoid certain classes of errors that are automatically caught by the compiler in other language.JavaScript was originally designed for small scripts in web pages to add a little interactivity here and there. In a 10-line script our eyeballs can easily catch coding errors. But as JavaScript applications grow in size and complexity, we obviously cannot trust the eyeball method to catch coding errors.In theory when the compiler helps to catch common errors, our programs are more robust. Enterprise software developers are accustomed to languages like Java or C# where every variable and method parameter is always correctly and accurately specified. The type for everything is known, allowing the compiler to catch type mismatches. But this sort of strict type checking comes at a cost in developer time.Is there a middle ground? A programming language with enough strictness to keep programmers from shooting themselves in the foot, but with the ease of use of JavaScript? For bonus points, the language should be deployable to JavaScript environments so it can bring rigor to the ever-more-complex in-browser applications being built today.TypeScript claims to be that language.Table of ContentsIntroductionWhat is TypeScript?Theory: Better programs through compile-time checksWhy use TypeScript?Quick StartSet up Typescript compiler and editing environmentWriting NodeJS modules using TypeScriptSetting up TypeORM, defining the main interfaceCreating TypeORM Entity classes, and CRUD methodsTesting TypeScript-based CommonJS moduleUsing Typescript in an Express applicationSetting up the Express server using TypeScriptInterfacing with back-end data storageRegistrar App User interface - CRUD screens, templates, etcRunning the TypeScript-implemented Express applicationGenerating type definitions for a TypeScript/Node.js moduleTypeScript failings discovered while writing this bookAbout the author - David Herron

Author: David Herron

Do you want ot get/download the Quick Start to using Typescript in Node.js applications as Paperback or Kindle/pdf eBook?

Get the Book