feat(medusa,utils): add server level configurable http compression (#3785)
* feat(medusa,utils): add server level configurable http compression * chore: remove unwanted middleware * chore: add a log for running compression * chore: change package position * chore: reposition options * chore: change equality
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
import { Router } from "express"
|
||||
import errorHandler from "./middlewares/error-handler"
|
||||
import compression from "compression"
|
||||
import admin from "./routes/admin"
|
||||
import store from "./routes/store"
|
||||
import { shouldCompressResponse, compressionOptions } from "../utils/api"
|
||||
|
||||
// guaranteed to get dependencies
|
||||
export default (container, config) => {
|
||||
const app = Router()
|
||||
const httpCompressionOptions = compressionOptions(config)
|
||||
|
||||
if (httpCompressionOptions.enabled) {
|
||||
app.use(
|
||||
compression({
|
||||
filter: shouldCompressResponse,
|
||||
...httpCompressionOptions,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
admin(app, container, config)
|
||||
store(app, container, config)
|
||||
|
||||
Reference in New Issue
Block a user