Compression Middleware

I am trying to use either compression or brotli compression using express middleware. I am using apollo-server-express integration.

The compression code is as follows:

app.use('/graphql',(req,res,next)=>{
        if(req.header('Accept-encoding').includes('br')){
            console.log('In here')
            app.use('/graphql',shrinkray({
                brotli:{
                    quality:9
                }
            }))
        }
        else{
            console.log('Out here')
            app.use(compression({
                level:7
            }))
        }
        next()
    })

Any help will be appreciated !!!

@fawkesG5 apollo-server-express uses expressjs behind the scenes, and last time I checked express doesn’t support brotli yet. Brotli support has tried to be added many times, and I think this PR has the best chance of succeeding, but it’s not there yet: Added support for brotli ('br') content-encoding by danielgindi · Pull Request #172 · expressjs/compression · GitHub

As for using the compression middleware, it should work by following the Apollo Server Applying middleware docs.

But when I use a separate brotli middleware the webpage is compressed. And also I am using another package to enable brotli compression.

Which Brotli middleware are you using?

shrink-ray-current package