How to Create REST APIs in Node.js using TypeScript

Creating REST APIs with Node.js & TypeScript - Part 1 of 4

A WebAPI consisting of endpoints to a request–response message system (JSON/XML) exposed as an HTTP-based server.
We will be using a tool called Huncwot that helps learn web programming and that optimizes for programmers productivity by reducing choices and incorporating community conventions.

Creating REST APIs in Node.js using TypeScript - PART 2 of 4

In the episode we discuss the notion of a web resource, which is a container for records of the same shape. We also mention the parallels between Web APIs and Object-oriented Programming. Finally, we implement a basic resource for representing technical events.

Creating REST APIs in Node.js using TypeScript - PART 3 of 4

In the episode we implement five methods to handle the CRUD operations for our Event resource. These are fetching, browsing, creating, updating and deleting resources. We distinguish the resource retrieval between browsing (responses generate collections) and fetching (getting a particular resource). The former will be shortly augmented with the ability to filter the event resources.

We also start using custom types by defining two interfaces. One for the events and another one for normalized byId event object. Our CRUD approach generates a bit of boilerplate.

Creating REST APIs in Node.js using TypeScript - PART 4 of 4

In the episode we refactor our application so that each resource is placed in a separate directory. On top of that we explicitly split the handlers for corresponding HTTP actions into separate files within our project. Lastly we use Huncwot conventions to reduce a bit the boilerplate and slightly speed up the resource creation.

https://github.com/huncwotjs/huncwot

#Nodejs #TypeScript #Angular #JavaScript #API

How to Create REST APIs in Node.js using TypeScript
37.00 GEEK