Book Image

MEAN Cookbook

By : Nicholas McClay
Book Image

MEAN Cookbook

By: Nicholas McClay

Overview of this book

The MEAN Stack is a framework for web application development using JavaScript-based technologies; MongoDB, Express, Angular, and Node.js. If you want to expand your understanding of using JavaScript to produce a fully functional standalone web application, including the web server, user interface, and database, then this book can help guide you through that transition. This book begins by configuring the frontend of the MEAN stack web application using the Angular JavaScript framework. We then implement common user interface enhancements before moving on to configuring the server layer of our MEAN stack web application using Express for our backend APIs. You will learn to configure the database layer of your MEAN stack web application using MongoDB and the Mongoose framework, including modeling relationships between documents. You will explore advanced topics such as optimizing your web application using WebPack as well as the use of automated testing with the Mocha and Chai frameworks. By the end of the book, you should have acquired a level of proficiency that allows you to confidently build a full production-ready and scalable MEAN stack application.
Table of Contents (13 chapters)

Using ES6 and Typescript with Express.js and Node.js

Node.js out of the box has virtually full support for ES6 (also known as ES2015) in version 6 and later versions. That means that even the long-term supported versions of Node.js now fully support ES6 syntax and features. However, many of the advanced language features used in Angular, such as optional typing, decorators, and interfaces are only available by using TypeScript. Using the same flavor of JavaScript helps you reduce the cost of context shifting between the backend and frontend of our web application. TypeScript will also help us prevent common typing errors and better modularization of our code. Luckily, TypeScript had first-class support for Node.js since the beginning. Let's explore how to convert our Express web server to use TypeScript.

...