Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

Calling a TypeScript Backend Without Integration Code - A Simple Task Tracker with Graftcode

Most developers building frontend applications spend a lot of time writing code that communicates with their backend due to the traditional approach (using APIs). This is not because the logic is hard to implement, but because the communication itself is complex. When using standard APIs, we build routes, define request and response models, generate clients, and keep multiple layers on track with…

Developers constructing frontend applications often dedicate considerable time crafting code to interact with their backend, stemming from the conventional methodology involving APIs. This is not due to the inherent complexity of the logic, but rather because of the inherent intricacy of communication itself. When employing standard APIs, developers must craft routes, specify request and response models, generate clients, and maintain alignment across application updates.

Conversely, Graftcode circumvents the need for exposing backend functionality via REST endpoints and instead generates packages that applications can install and utilize as dependencies. This effectively transforms the communication model into one where backend methods are called as if they were library functions, rather than being accessed through HTTP clients with strongly typed interfaces.

Engaging with Graftcode is straightforward: simply install the library and invoke its functions. In this article, we will construct a simplistic task tracker or to-do list application utilizing React and a TypeScript backend to illustrate the practical application of Graftcode. Throughout this blog post, we will delve into the following aspects: The necessity of manually managing API layers The functionality provided by Graftcode Gateway The utility of Graftcode Vision in identifying backend capabilities The familiarity of APIs and fetch() requests The utilization of TypeScript backend logic within React applications without the necessity of constructing API routes The enhancement of developer experience through strongly-typed backend packages The prerequisites for embarking on this project include having the latest Node version installed, a foundational understanding of React and TypeScript, familiarity with APIs and fetch requests (to appreciate the simplicity of Graftcode’s approach), a Graftcode account, Graftcode gateway installed on the local machine.

By completing these prerequisites, participants will not only grasp why to-do list applications predominantly rely on APIs for functionality but also the challenges associated with this approach.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Thursday 20 August →