The international conference on the API Platform Framework
The API Platform Conference 2024 is happening soon, and it's close to selling out.
API Platform 4, Caddy web server, Xdebug, AI... Enjoy two days of inspiring talks with our friendly community and our amazing speakers.
The TypeScript Generator allows you to create TypeScript interfaces that you can embed in any TypeScript-enabled project (React, Vue.js, Angular..).
To do so, run the generator:
npm init @api-platform/client --generator typescript https://demo.api-platform.com src/ --resource foo
# Replace the URL with the entrypoint of your Hydra-enabled API.
src/
is where the interfaces will be generated.
Omit the resource flag to generate files for all resource types exposed by the API.
You can also use an OpenAPI documentation with -f openapi3
.
This command parses the Hydra documentation and creates one .ts
file for each API Resource you have defined in your application, in the interfaces
subfolder.
Note: If you are not sure what the entrypoint is, see Troubleshooting.
Assuming you have 2 resources in your application, Foo
and Bar
, when you run:
npm init @api-platform/client --generator typescript https://demo.api-platform.com src/
You will obtain 2 .ts
files arranged as following:
You can also help us improve the documentation of this page.
Made with love by
Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.
Learn more