July 2019
Intermediate to advanced
416 pages
10h 6m
English
As well as having a common way of working with the database, our incoming API requests are all going to be very similar in terms of endpoints. While writing this book, I tried to put together snippets of code that could be reused later on. One such snippet is the way we handle Express routing. The server-side code we put together in Chapter 4, The MEAN Stack – Building a Photo Gallery, was one such area, specifically the code for routing. We can bring this code in pretty much exactly as we wrote it all those chapters ago.
Here's a quick reminder of what the code looks like. First, we have our IRouter interface:
export interface IRouter { AddRoute(route: any): void;}
Then, we have our routing engine—the code ...
Read now
Unlock full access