add compression middleware to worldmap

This commit is contained in:
Dave Conway-Jones 2019-06-23 16:50:56 +01:00
parent 83c726966a
commit ac57a17062
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@
"description": "A Node-RED node to provide a web page of a world map for plotting things on.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"cgi": "0.3.1", "cgi": "0.3.1",
"compression": "^1.7.4",
"express": "^4.16.4", "express": "^4.16.4",
"sockjs": "^0.3.19" "sockjs": "^0.3.19"
}, },

View File

@ -18,6 +18,7 @@ module.exports = function(RED) {
"use strict"; "use strict";
var path = require("path"); var path = require("path");
var express = require("express"); var express = require("express");
var compression = require("compression");
var sockjs = require('sockjs'); var sockjs = require('sockjs');
var sockets = {}; var sockets = {};
RED.log.info("Worldmap version " + require('./package.json').version ); RED.log.info("Worldmap version " + require('./package.json').version );
@ -53,6 +54,7 @@ module.exports = function(RED) {
this.log("started at "+this.path); this.log("started at "+this.path);
var node = this; var node = this;
var clients = {}; var clients = {};
RED.httpNode.use(compression());
RED.httpNode.use(node.path, express.static(__dirname + '/worldmap')); RED.httpNode.use(node.path, express.static(__dirname + '/worldmap'));
var callback = function(client) { var callback = function(client) {