query: 给URL跟问号参数?filter=popular&order=date,得到log { filter: 'popular', order: 'date' }
This commit is contained in:
parent
31f62a8fa8
commit
9479429b8c
|
@ -1,14 +1,10 @@
|
||||||
import { Controller, Get, Req } from '@nestjs/common';
|
import { Controller, Get, Req, Query } from '@nestjs/common';
|
||||||
|
|
||||||
@Controller('posts')
|
@Controller('posts')
|
||||||
export class PostsController {
|
export class PostsController {
|
||||||
@Get()
|
@Get()
|
||||||
index(@Req() request) {
|
index(@Query() query) {
|
||||||
console.log(
|
console.log(query)
|
||||||
request.ip,
|
|
||||||
request.hostname,
|
|
||||||
request.method,
|
|
||||||
)
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: 'hello ~'
|
title: 'hello ~'
|
||||||
|
|
Loading…
Reference in New Issue