Skip to content

Commit

Permalink
add cloudflare caching
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Aug 13, 2023
1 parent 4ab71c4 commit 89153c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const cache = (duration) => {
}

app.get("/amg/1", cache(120), (req, res, next) => {
res.set('Cache-Control', 'public, max-age=120');
Gamedig.query({
type: "forrest",
host: "157.90.7.148",
Expand All @@ -46,6 +47,7 @@ app.get("/amg/1", cache(120), (req, res, next) => {
});

app.get("/amg/2", cache(120), (req, res, next) => {
res.set('Cache-Control', 'public, max-age=120');
Gamedig.query({
type: "rust",
host: "51.77.77.129",
Expand All @@ -58,6 +60,7 @@ app.get("/amg/2", cache(120), (req, res, next) => {
});

app.get('/game/:gamename/:host/:port', cache(120), (req, res, next) => {
res.set('Cache-Control', 'public, max-age=120');
Gamedig.query({
type: req.params.gamename,
host: req.params.host,
Expand Down

0 comments on commit 89153c3

Please sign in to comment.