Git Product home page Git Product logo

dot's Issues

UI组件中常规方法做成配置

类似一下方法:
d.Engine_.GinEngine().GET("/", func(ctx *gin.Context) {
ctx.Redirect(http.StatusFound, d.UrlRelativePath()+"/home.html")
})

//for dev
{
if !sfile.ExistFile(d.ResAbsolutePath("dist")) {
dot.Logger().Debugln("UiPreAdd", zap.String("", "../../ui"))
d.SetResRelativePath("../../ui")
}
}
通过配置的方式实现,减少路由冲突以及修改方便。

add "endpointsFunc" in the struct ginNobl

in old version "github.com/improbable-eng/grpc-web", it can not modify the "endpointsFunc", so we do follow:

if len(c.preUrl) > 0 { // because can not set the "endpointFunc" of WrapServer, do this so so
old := ctx.Request.URL.Path
if strings.HasPrefix(old, c.preUrl) {
index := len(c.preUrl) - 1
ctx.Request.URL.Path = old[index:]
}
}
but in new version, can modiry the "endpointsFunc", it will be better to replace with "endpointsFunc"

run once callback function in slog

sample :
//Warn warn
func (log *sLogger) Warn(mstr dot.MakeStringer) {
if dot.WarnLevel <= log.GetLevel() {
log.Logger.Warn(funLog, zap.String("", mstr()))
}
}

关于Engine组件中字段命名建议

在使用Engine组件时将http升级为https时需要配置keyFile和pemFile两个文件,在使用openssl生成证书文件过程中会生成私钥、公钥以及证书三个文件,就文件格式而言他们都可以是pem格式,为了避免不了解的人配置出错,建议将PemFile修改为CertFile。跟踪代码进入到gin提供的RunTLS函数,它的命名建议也是certFile和keyFile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.