会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
保持理智,相信未来
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
···
9
下一页
2022年11月10日
grpc的负载均衡
摘要: 一.grpc的负载均衡介绍 1.官网地址 https://github.com/grpc/grpc/blob/master/doc/load-balancing.md 2.架构 3. Name Resolver(grpc从consul中同步服务信息进行负载均衡) 作用:从指定的DNS服务器或者一个注
阅读全文
posted @ 2022-11-10 13:15 wanghhhh
阅读(267)
评论(0)
推荐(0)
2022年11月9日
gin-consul配置到全局
摘要: 一.配置全局变量 global/golbal.go中添加: UserSrvClient proto.UserClient package global import ( ut "github.com/go-playground/universal-translator" "mxshop-api/us
阅读全文
posted @ 2022-11-09 16:04 wanghhhh
阅读(105)
评论(0)
推荐(0)
2022年11月8日
consul-在项目中使用
摘要: 一. 在python项目中使用 1.目录存放 创建公共目录存放common/register,创建base.py register.py 2.base.py基础类 import abc class Resister(metaclass=abc.ABCMeta): @abc.abstractmetho
阅读全文
posted @ 2022-11-08 17:27 wanghhhh
阅读(66)
评论(0)
推荐(0)
2022年11月7日
consul的状态注册和发现及检查
摘要: 一. 使用requests使用注册 1. python服务注册及检查 可以对http接口和grpc接口进行状态健康检测 import requests headers = { "contentType": "application/json" } def register(name, id, add
阅读全文
posted @ 2022-11-07 18:12 wanghhhh
阅读(120)
评论(0)
推荐(0)
2022年11月5日
gin-图形验证码
摘要: 文档地址:https://mojotv.cn/go/refactor-base64-captcha 1. 在api接口文件中配置生成验证码的代码 在user-web/api下面创建chaptcha.go文件 package api //导入 import ( "github.com/gin-goni
阅读全文
posted @ 2022-11-05 13:43 wanghhhh
阅读(370)
评论(0)
推荐(0)
2022年11月3日
gin-解决跨域问题
摘要: 1.在middlewares中创建cors.go文件 package middlewares import ( "github.com/gin-gonic/gin" "net/http" ) func Cors() gin.HandlerFunc { return func(c *gin.Conte
阅读全文
posted @ 2022-11-03 10:09 wanghhhh
阅读(118)
评论(0)
推荐(0)
2022年11月1日
gin-权限控制-JWT结合gin实现权限控制
摘要: 一. 如何使用JWT结合gin实现token生成 1. 创建文件,在mxshop-api/user-web/middlewares 下面添加固定文件 package middlewares import ( "errors" "github.com/dgrijalva/jwt-go" "github
阅读全文
posted @ 2022-11-01 15:08 wanghhhh
阅读(509)
评论(0)
推荐(0)
2022年10月31日
gin表单验证
摘要: 一. 表单验证的初始化 1. 定义forms验证 在forms目录下创建user.go文件 增加验证的struct内容 package forms type PassWordLoginForm struct { Mobile string `form:"mobile" json:"mobile" b
阅读全文
posted @ 2022-10-31 14:05 wanghhhh
阅读(170)
评论(0)
推荐(0)
2022年10月28日
gin-配置文件管理
摘要: 1. 使用库viper 使用示例 package main import ( "fmt" "github.com/spf13/viper" ) type ServerConfig struct { ServiceName string `mapstructure:"name"` Port int `
阅读全文
posted @ 2022-10-28 13:41 wanghhhh
阅读(247)
评论(0)
推荐(0)
gin-构建第一个gin项目
摘要: 1. 项目目录结构 2. 定义main函数 package main import ( "fmt" "go.uber.org/zap" "mxshop-api/user-web/initialize" ) func main() { //初始化logger initialize.InitLogger
阅读全文
posted @ 2022-10-28 09:55 wanghhhh
阅读(161)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
···
9
下一页
公告