網站首頁 編程語言 正文
axios-GET請求
created() { console.log('該組件要被加載成功了') this.$axios({ url: "http://127.0.0.1:8080/student/3", method: "GET", headers: { // 'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'multipart/form-data' } }).then(response => { console.log(response) } ).catch(error => { console.log(456) console.log(error) } );
Gin-GET響應
r.GET("/student/:ID", func(c *gin.Context) { id := c.Param("ID") var student Student _ = c.ShouldBind(&student) db.Preload("Teachers").Preload("IDCard").First(&student, "id=?", id) c.JSON(200, gin.H{ "msg": student, }) })
Vue-POST請求
this.$axios({ url: "http://127.0.0.1:8080/test", method: "post", headers: { 'Content-Type':'application/x-www-form-urlencoded', }, data: { "name": "jeff", "age": 18 } }).then(response => { console.log(response) } ).catch(error => { console.log(456) console.log(error) } );
Gin-POST響應
r.POST("/test", func(c *gin.Context) { user := c.PostForm("name") pwd := c.PostForm("age") fmt.Println(user) fmt.Println(pwd) fmt.Println(c) c.JSON(200, gin.H{ "msg": "成功!", }) })
原文鏈接:https://www.cnblogs.com/guyouyin123/p/14169363.html
- 上一篇:Python文件的壓縮與解壓_python
- 下一篇:C#實現歸并排序_C#教程
相關推薦
- 2022-04-25 老生常談C語言中指針的使用_C 語言
- 2023-09-12 spring webflux配置成tomcat的線程池
- 2022-12-28 Python中的Decorator裝飾器的使用示例_python
- 2023-07-16 spring boot多模塊打包 運行
- 2022-04-23 window.open打開新窗口設置顯示位置及大小
- 2022-08-21 caffe的python接口生成配置文件學習_python
- 2022-07-22 idea 編譯項目后target包沒有resources文件
- 2022-04-16 python案例練習合集_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支