Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 2.04 KB

README.md

File metadata and controls

41 lines (26 loc) · 2.04 KB

WebDC2019-AngularNestJS

Contents

All-the-way: Angular ❤️ NestJS

You love Angular, TypeScript, and you are fluent in building client apps? At some point, you may need to write server-side APIs. As it is natural to use the same language in the backend as in the frontend, you are likely to choose Node.js. However, when using libraries like Express or even plain Node you are often leaving known territory lacking good idioms and structural patterns.

Have you ever heard of NestJS? It is a framework to build efficient, reliable and scalable server-side applications. What is remarkable about it is that it uses similar concepts as Angular. You can organize your code into modules. It works with dependency injection of services into controllers (which are in a way your components for API routes) and even has a CLI to get you started quickly.

We will investigate what a project structure with an Angular front- and NestJS backend could look like, we proceed to implement our first API routes and we finally conclude testing them. Since it is so easy, we will also generate a nice API documentation on-the-go and will take a peek at helpful, already built-in plugins. In the end, you should be ready to develop your full stack web application using a marriage of Angular and NestJS.


Steps taken

Client App ngCompanion

Created the routed Angular Client ngCompanion without E2E and unit testing with the component prefix wdc (Web Developer Conference) using SCSS as CSS preprocessor.

ng new ng-companion --minimal true --style scss --prefix wdc --routing true

Server App with Express

  • Move local dummy data to server

Server App with NestJS

  • Implement controllers, services, and modules
  • Extract common interface
  • Replace server dummy data with Atlas MongoDB access
  • Add service unit tests
  • Add swagger documentation