当前位置: 首页 > news >正文

做的好的公司网站自己怎么做百度推广

做的好的公司网站,自己怎么做百度推广,网站运营公司,玉田网站制作nest.js控制器: 控制器负责处理传入请求并向客户端返回响应。 为了创建基本控制器,我们使用类和装饰器。装饰器将类与所需的元数据相关联,并使 Nest 能够创建路由映射(将请求绑定到相应的控制器)。 1.获取get请求传参…

nest.js控制器: 控制器负责处理传入请求并向客户端返回响应。
为了创建基本控制器,我们使用类和装饰器。装饰器将类与所需的元数据相关联,并使 Nest 能够创建路由映射(将请求绑定到相应的控制器)。
在这里插入图片描述

1.获取get请求传参,用@Request装饰器或者@Query()装饰器

import {Controller,Get,Request,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1', //版本控制
})
export class WeiController {constructor(private readonly weiService: WeiService) { }// @Request装饰器@Get()findAll(@Request() req) {console.log('@', req.query)return {code: 200,message: '请求成功W'}}
}
import {Controller,Get,Query,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1', //版本控制
})
export class WeiController {constructor(private readonly weiService: WeiService) { }// @Query()装饰器@Get()findAll(@Query() query) {console.log('@@', query)return {code: 200,message: '请求Q成功'}}
}

2.post请求获取参数,用@Request装饰器或者@Body 装饰器

import {Controller,Get,Query,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1',
})
export class WeiController {constructor(private readonly weiService: WeiService) { }//用@Request装饰器@Post()create(@Request() req) {console.log(req.body)return {code: 200,message: '请求成功!'}}
}
import {Controller,Get,Query,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1',
})
export class WeiController {constructor(private readonly weiService: WeiService) { }//用@Body装饰器@Post()create(@Body() body) {console.log(body)return {code: 200,message: '请求成功!'}}
}

读取请求体中得key值

import {Body,Controller,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1',
})
export class WeiController {constructor(private readonly weiService: WeiService) { }// 读取key@Post()create(@Body("title") body) {console.log(body)return {code: 200,message: '请求成功'}}
}

动态传参使用 Request装饰器 或者 Param 装饰器

import {Controller,Request,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1',
})
export class WeiController {constructor(private readonly weiService: WeiService) { }// 动态路由// Request装饰器 或者 Param 装饰器@Get(':id')findId(@Request() req) {console.log('@@@@@@', req.params)return {code: 200,message: '请求成功!!!!!!'}}
}

header信息读取使用@header装饰器

import {Controller,Get,Headers,
} from '@nestjs/common';import { WeiService } from './wei.service';@Controller({path: 'wei',version: '1',
})
export class WeiController {constructor(private readonly weiService: WeiService) { }// 读取header 信息@Get(':id')findId(@Headers() header) {console.log('header', header)return {code: 200,message: '请求成功!!!!!!'}}
}
http://www.hkea.cn/news/815233/

相关文章:

  • 唯品会 一家专门做特卖的网站沈阳seo按天计费
  • 聊城手机网站建设郑州seo服务技术
  • 个人定做衣服店江门seo推广公司
  • 网站开发与网站建设山东济南seo整站优化费用
  • 香港疫情最新消息今天深圳seo教程
  • 维护一个网站难吗免费发布外链
  • 南安市网站建设成都今天重大新闻事件
  • 网站后台补丁如何做软文有哪几种类型
  • 网站建设的费用包括哪些内容资讯门户类网站有哪些
  • 一站式服务图片制作网页的基本步骤
  • 个人网站建设网站网络网站推广
  • asp做的药店网站模板北京百度快照推广公司
  • 网站建设泉州效率网络seo的优化策略有哪些
  • 页网站无锡网站制作推广
  • 一流的龙岗网站建设目前最靠谱的推广平台
  • 企业营销型网站费用短视频推广引流
  • 化妆品可做的团购网站有哪些seo研究中心南宁线下
  • 网站空间域名是什么做电商必备的几个软件
  • 软件公司运营是做什么的seo公司运营
  • 专业云南做网站福州短视频seo服务
  • 网站开发技术期中试题电商培训机构排名
  • 网站设计连接数据库怎么做如何进行百度推广
  • 日本网站图片做淘宝代购网络营销促销方案
  • 网站开发导航栏网站制作的费用
  • 盐城网站设计网站流量统计工具
  • 网站上如何做相关推荐郑州建网站的公司
  • 漂亮大气的装潢室内设计网站模板 单页式html5网页模板包前端优化
  • 论坛网站开发开题报告青岛百度推广多少钱
  • 文山做网站如何优化百度seo排名
  • 上海展陈设计公司有哪些成都网站seo性价比高