Skip to content

Commit

Permalink
add caching to improve load time
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsteward committed Jan 3, 2023
1 parent 8595368 commit 77c86ac
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"dependencies": {
"@observablehq/plot": "^0.6.1",
"apicache": "^1.6.3",
"async": "^3.2.0",
"cookie-parser": "~1.4.4",
"d3": "^7.8.0",
Expand Down
5 changes: 4 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ var express = require('express');
var router = express.Router();
var async = require('async');
var stats = require('../modules/data');
var apicache = require('apicache');
const { stat } = require('fs');

const APP_TITLE = 'HAM Dashboard';

let cache = apicache.middleware;

let data = {
datafreshness: 0,
dateoflastrefresh: "2000-01-01",
Expand Down Expand Up @@ -43,7 +46,7 @@ router.get('/:env', function(req, res, next) {
});

/* GET home page. */
router.get('/', function(req, res, next) {
router.get('/', cache('6 hours'), function(req, res, next) {

async.parallel({
objectStats: stats.getObjectStats,
Expand Down

0 comments on commit 77c86ac

Please sign in to comment.