mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 17:22:24 -05:00
[feature] Gin enable gzip encoding (#405)
* add gin gzip dependency * add gzip middleware to router * go mod tidy
This commit is contained in:
parent
23034ec145
commit
a089a98ea9
11 changed files with 442 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue