Controller

The controller plugin is the base for all other included plugins. All plugins mark @sdr/controller as an explicit dependency, so it is not neccesary to include it in your configuration file. It defines the following directives.

Install

yarn add @sdr/controller

Code Generation

This plugin does not emit any code.


Directives

controller

Add this to your top level types. This is how you group your web requests. Once you decorate your type with this it must only contain methods, not fields. The methods must be decorated with request.

OptionsDescription
pathThe path for this grouping of requests

request

Add this to the methods within a controller. It defines your web requests.

OptionsDescription
pathThe path for request
methodThe REST method for this request. Allowed values are GET, POST, PUT, DELETE.

model

Add this to the types, unions, enums, inputs, and interfaces that you wish to emit typescript code for.

Dependencies

None