Skip to content

universal-packages/universal-express-controllers-parameters

Repository files navigation

Express controllers parameters

npm version Testing codecov

Express parameters for universal controllers.

Install

npm install @universal-packages/express-controllers-parameters

npm install express
npm install @universal-packages/express-controllers

Global middleware

By installing this package a global middleware is going to be loaded automatically by the ExpressControllers.

Global methods

setUnionKind(unionKind: string)

Set up the global middleware parameters union kind by calling this function at any given moment.

import { setUnionKind } from '@universal-packages/express-controllers-parameters'

setUnionKind('join')

Hooks

@UseParameters([unionKind: string])

Optionally you can set a different strategy for a particular action using this decorator.

import { BaseController, Controller, Get, Post } from '@universal-packages/express-controllers'
import { UseParameters } from '@universal-packages/express-controllers-parameters'

@Controller('good')
export default class GoodController extends BaseController {
  @Get()
  @UseParameters('separate')
  async action() {
    this.request.parameters
  }
}

Typescript

This library is developed in TypeScript and shipped fully typed.

Contributing

The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

License

MIT licensed.