@xen-orchestra/rest-api

0.6.0 • Public • Published

@xen-orchestra/rest-api

Package Version License PackagePhobia Node compatibility

REST API to manage your XOA

Install

Installation of the npm package:

npm install --save @xen-orchestra/rest-api

Usage

@xen-orchestra/rest-api

Rules

The REST API is based on the TSOA framework and therefore we use decorators a lot to define the behavior of a route or a group of routes. To keep things easily visible, it is best to always use the decorators in the same order.

Class decorator

@Routes('foo')
@Security('*')
@Response(401)
@Tags('foo')
@provide(Foo)
class Foo extends Controller {}

Methods decorator

@Routes('foo')
...
class Foo extends Controller {


 /**
  * any jsdoc anotations
  * @example id 1234
  */
 @Example(['foo', 'bar'])
 @Get('{id}')
 @Security('*')
 @SuccessResponse(202)
 @Response(404)
 getFoo(@Path() id: string) {
    return this.getFoo(id)
 }
}

Examples

In order not to pollute important decorators, all example structures should be in a separate file. src/open-api/examples/<resource>.example.mts

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

AGPL-3.0-or-later © Vates SAS

Readme

Keywords

none

Package Sidebar

Install

npm i @xen-orchestra/rest-api

Weekly Downloads

12

Version

0.6.0

License

AGPL-3.0-or-later

Unpacked Size

798 kB

Total Files

56

Last publish

Collaborators

  • mlssfrncjrg
  • mathieura
  • stephane-m-dev
  • florent.beauchamp
  • julien-f
  • marsaud
  • pdonias
  • olivierlambert
  • benjireis
  • tgoettelmann
  • b-nollet
  • joris-k
  • sebastianczech
  • olivier.f