Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Shared API types between frontend and backend #218

Open
mantariksh opened this issue Sep 6, 2021 · 0 comments
Open

Shared API types between frontend and backend #218

mantariksh opened this issue Sep 6, 2021 · 0 comments
Assignees

Comments

@mantariksh
Copy link
Collaborator

APIs are a contract between the frontend and backend. This means that the client and server should agree on the shape of every API. In order to ensure that the frontend and backend agree on the API shapes without duplicating code, it makes sense for API types to be shared between the frontend and backend.

Implementing this will involve the following steps:

  1. Edit the build pipeline to accommodate shared code between the client and server directories.
  2. Create base types for each database table and have the model types inherit from the shared base types.
  3. Create types for each API's return shape by composing the base types, and use these types in both the frontend services (which call the API) and the backend controllers (which serve the responses).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant