-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
demonstrate extracting an endpoint type from server
in this commit I demonstrate to @surmavagit how the return data type of an endpoint can be extracted to the moon tool project called queries which is located at `packages/prisma-queries` in the repo in this example, the endpoint /api/tables/mine uses a combination of a `findMany` Prisma query (on the TablePhysical model) and a mapping function to produce the results of the endpoint the example extracts both the query parameters and the mapper function and uses some Prisma and Typescript magic to produce the exact type to be returned by the endpoint automatically this way, the frontend will be able to import the same type using: ``` import { TableWithOrders } from "prisma-queries" ```
- Loading branch information
Showing
6 changed files
with
73 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.