Creating API Endpoints

Initialize Your API Endpoint

Viewing typescript

switch to python

via the CLI

To create a new Consumption API endpoint, leverage the moose-cli consumption init command.

Terminal
npx moose-cli consumption init <YOUR_API_ROUTE>
  • <YOUR_API_ROUTE>: The name of the route you want to create.

This command will generate a .ts file in the /apis directory.

      • YOUR_API_ROUTE.ts
  • For detailed information about the moose block init command, you can run the following in your terminal:

    Terminal
    npx moose-cli consumption init --help

    Manually

    You can alternatively manually create a new .ts file inside the /apis folder of your project.