The last stretch! We will create our final namespace, Crumb, and connect it to our other models and our router

A Crumb works in a different way than the duck and quack namespace. A Crumb in itself cannot exist without the two other namespaces, and works as amany-to-many connection between the two.

Crumb model#

The Crumb interface is slightly different than the previous two:

As both columns are foreign keys, we will use the type reference to keep track of the properties.

Crumb service#

With the interface out of the way, we can move on to the service:

In our application we only need a toggle to create or remove the connection between a Duck and a Quack. The data object should contain the Duck and Quack IDs, as well as boolean connection. As we don't care about the output, we don't have to return any data.


This page is a preview of Build and deploy a REST API with Deno

Start a new discussion. All notification go to the author.