Skip to content

Instantly share code, notes, and snippets.

@dan-dm
Forked from ezirmusitua/parse-int-query.ts
Created November 16, 2021 12:00
Show Gist options
  • Save dan-dm/48defb03baf2cc3da4bda3fbcc2f3c27 to your computer and use it in GitHub Desktop.
Save dan-dm/48defb03baf2cc3da4bda3fbcc2f3c27 to your computer and use it in GitHub Desktop.
[Parse integer query params] parse integer query parameters in nestjs #node #nestjs
import {
Controller,
Get,
ParseIntPipe,
Query,
} from '@nestjs/common';
export class GalleryController {
constructor() {
}
@Get('')
thumbnail(@Query('id', ParseIntPipe) id: number) {
console.log('int query parameter id: ', id)
return {id}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment