上一页 1 2 3 4 5 6 7 ··· 9 下一页
摘要: 一.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)
摘要: 一.配置全局变量 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)
摘要: 一. 在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)
摘要: 一. 使用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)
摘要: 文档地址: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)
摘要: 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)
摘要: 一. 如何使用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)
摘要: 一. 表单验证的初始化 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)
摘要: 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)
摘要: 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 下一页