mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Gin enable gzip encoding (#405)
* add gin gzip dependency * add gzip middleware to router * go mod tidy
This commit is contained in:
@ -137,11 +137,8 @@ func New(ctx context.Context, db db.DB) (Router, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// set template functions
|
||||
LoadTemplateFunctions(engine)
|
||||
|
||||
// load templates onto the engine
|
||||
if err := loadTemplates(engine); err != nil {
|
||||
// enable gzip compression on the engine
|
||||
if err := useGzip(engine); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -150,6 +147,14 @@ func New(ctx context.Context, db db.DB) (Router, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// set template functions
|
||||
LoadTemplateFunctions(engine)
|
||||
|
||||
// load templates onto the engine
|
||||
if err := loadTemplates(engine); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// create the http server here, passing the gin engine as handler
|
||||
bindAddress := viper.GetString(keys.BindAddress)
|
||||
port := viper.GetInt(keys.Port)
|
||||
|
Reference in New Issue
Block a user