add compression middleware
This commit is contained in:
parent
051b6fccd3
commit
9279aa0767
2 changed files with 4 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/RealOrangeOne/host-container#readme",
|
||||
"dependencies": {
|
||||
"compression": "=1.6.2",
|
||||
"connect-static-file": "=1.1.2",
|
||||
"express": "=4.14.0"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const express = require('express');
|
||||
const staticFile = require('connect-static-file');
|
||||
const compression = require('compression');
|
||||
const path = require('path');
|
||||
|
||||
const PORT = 5000;
|
||||
|
@ -16,6 +17,8 @@ const expressConfig = {
|
|||
|
||||
const app = express();
|
||||
|
||||
app.use(compression({ level: 9 }));
|
||||
|
||||
|
||||
app.use(function (request, response, next) {
|
||||
if (directory.exec(request.url)) {
|
||||
|
|
Reference in a new issue