Skip to content

Commit

Permalink
Simplified caching code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon committed Aug 28, 2024
1 parent 0e6f5bf commit fda4fb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 4 additions & 7 deletions GuildWarsPartySearch.NodeJSServer/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
is_websocket,
send_header,
send_json,
build_express_cache_options, is_http
is_http
} from "./src/js/networking.mjs";
import * as path from "path";
import {
Expand Down Expand Up @@ -686,11 +686,8 @@ function get_request_context(request) {
return store;
}

let two_week_cache = {
maxAge: '14d',
etag: true,
lastModified: true
};
const two_week_cache = {maxAge: '14d', etag: true, lastModified: true};
const one_hour_cache = {maxAge: '1h', etag: true, lastModified: true};

morgan.token('custom-date', () => {
return (new Date()).format('d/MM/Y H:i:s');
Expand Down Expand Up @@ -720,7 +717,7 @@ app.use(function (req, res, next) {
['tiles','cards','resources','assets'].forEach((folder) => {
app.use(`/${folder}/`, express.static(path.join(__dirname, 'dist',folder), two_week_cache));
})
app.use('/', express.static(path.join(__dirname, 'dist'), build_express_cache_options(60 * 1000)));
app.use('/', express.static(path.join(__dirname, 'dist'), one_hour_cache));
app.use('/api', on_http_message);

const http_server = http.createServer();
Expand Down
2 changes: 0 additions & 2 deletions GuildWarsPartySearch.NodeJSServer/src/js/gw_constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2786,5 +2786,3 @@ export function district_from_region(district_region, district_language) {
}
return districts.Current;
}

console.log(getMapInfo(map_ids.Forum_Highlands));

0 comments on commit fda4fb7

Please sign in to comment.