From e87af94a0d9287880f99d1701ea94b46f5bb525a Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Fri, 17 May 2019 23:09:48 +0200 Subject: [PATCH] Add response-time package --- client/src/data/data.js | 2 -- client/src/views/Summoner.vue | 2 +- server/package-lock.json | 16 ++++++++++++++++ server/package.json | 3 ++- server/server.js | 4 ++++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/client/src/data/data.js b/client/src/data/data.js index 5ccb7cb..9199fb8 100644 --- a/client/src/data/data.js +++ b/client/src/data/data.js @@ -1,5 +1,3 @@ -export const championsId = { 266: "Aatrox", 103: "Ahri", 84: "Akali", 12: "Alistar", 32: "Amumu", 34: "Anivia", 1: "Annie", 22: "Ashe", 136: "AurelionSol", 268: "Azir", 432: "Bard", 53: "Blitzcrank", 63: "Brand", 201: "Braum", 51: "Caitlyn", 164: "Camille", 69: "Cassiopeia", 31: "Chogath", 42: "Corki", 122: "Darius", 131: "Diana", 119: "Draven", 36: "DrMundo", 245: "Ekko", 60: "Elise", 28: "Evelynn", 81: "Ezreal", 9: "Fiddlesticks", 114: "Fiora", 105: "Fizz", 3: "Galio", 41: "Gangplank", 86: "Garen", 150: "Gnar", 79: "Gragas", 104: "Graves", 120: "Hecarim", 74: "Heimerdinger", 420: "Illaoi", 39: "Irelia", 427: "Ivern", 40: "Janna", 59: "JarvanIV", 24: "Jax", 126: "Jayce", 202: "Jhin", 222: "Jinx", 145: "Kaisa", 429: "Kalista", 43: "Karma", 30: "Karthus", 38: "Kassadin", 55: "Katarina", 10: "Kayle", 141: "Kayn", 85: "Kennen", 121: "Khazix", 203: "Kindred", 240: "Kled", 96: "KogMaw", 7: "Leblanc", 64: "LeeSin", 89: "Leona", 127: "Lissandra", 236: "Lucian", 117: "Lulu", 99: "Lux", 54: "Malphite", 90: "Malzahar", 57: "Maokai", 11: "MasterYi", 21: "MissFortune", 62: "MonkeyKing", 82: "Mordekaiser", 25: "Morgana", 267: "Nami", 75: "Nasus", 111: "Nautilus", 76: "Nidalee", 56: "Nocturne", 20: "Nunu", 2: "Olaf", 61: "Orianna", 516: "Ornn", 80: "Pantheon", 78: "Poppy", 555: "Pyke", 133: "Quinn", 497: "Rakan", 33: "Rammus", 421: "RekSai", 58: "Renekton", 107: "Rengar", 92: "Riven", 68: "Rumble", 13: "Ryze", 113: "Sejuani", 35: "Shaco", 98: "Shen", 102: "Shyvana", 27: "Singed", 14: "Sion", 15: "Sivir", 72: "Skarner", 37: "Sona", 16: "Soraka", 50: "Swain", 134: "Syndra", 223: "TahmKench", 163: "Taliyah", 91: "Talon", 44: "Taric", 17: "Teemo", 412: "Thresh", 18: "Tristana", 48: "Trundle", 23: "Tryndamere", 4: "TwistedFate", 29: "Twitch", 77: "Udyr", 6: "Urgot", 110: "Varus", 67: "Vayne", 45: "Veigar", 161: "Velkoz", 254: "Vi", 112: "Viktor", 8: "Vladimir", 106: "Volibear", 19: "Warwick", 498: "Xayah", 101: "Xerath", 5: "XinZhao", 157: "Yasuo", 83: "Yorick", 154: "Zac", 238: "Zed", 115: "Ziggs", 26: "Zilean", 142: "Zoe", 143: "Zyra" }; - export const maps = { 10: "The Twisted Treeline", 11: "Summoner's Rift", 12: "Howling Abyss" }; export const gameModes = { 76: 'URF', 100: 'ARAM', 400: 'Normal (Draft)', 420: 'Ranked (Solo)', 430: 'Normal (Blind)', 440: 'Ranked (Flex)', 460: '3v3 Blind', 470: '3v3 Ranked (Flex)', 800: '3v3 Co-op vs. AI (Intermediate)', 810: '3v3 Co-op vs. AI (Intro)', 820: '3v3 Co-op vs. AI (Beginner)', 830: 'Co-op vs. AI (Intro)', 840: 'Co-op vs. AI (Beginner)', 850: 'Co-op vs. AI (Intermediate)' } diff --git a/client/src/views/Summoner.vue b/client/src/views/Summoner.vue index bd183f3..584ea2b 100644 --- a/client/src/views/Summoner.vue +++ b/client/src/views/Summoner.vue @@ -61,7 +61,7 @@ import summonersJSON from '@/data/summoner.json' import Match from '@/components/Match.vue'; import SearchForm from '@/components/SearchForm.vue'; -import { championsId, maps, gameModes } from "@/data/data.js"; +import { maps, gameModes } from "@/data/data.js"; import { timeDifference, secToTime, getRankImg } from "@/helpers/functions.js"; export default { diff --git a/server/package-lock.json b/server/package-lock.json index 2ea145d..b56a0b7 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -516,6 +516,12 @@ "ee-first": "1.1.1" } }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true + }, "parseurl": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", @@ -623,6 +629,16 @@ "lodash": "^4.13.1" } }, + "response-time": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/response-time/-/response-time-2.3.2.tgz", + "integrity": "sha1-/6cbq5UtYvfB1Jt0NDVfvGjf/Fo=", + "dev": true, + "requires": { + "depd": "~1.1.0", + "on-headers": "~1.0.1" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", diff --git a/server/package.json b/server/package.json index 38dbc81..720affd 100644 --- a/server/package.json +++ b/server/package.json @@ -19,6 +19,7 @@ }, "devDependencies": { "cors": "^2.8.5", - "cross-env": "^5.2.0" + "cross-env": "^5.2.0", + "response-time": "^2.3.2" } } diff --git a/server/server.js b/server/server.js index f2ec6d3..4f30ee1 100644 --- a/server/server.js +++ b/server/server.js @@ -4,6 +4,7 @@ const request = require('request'); const bodyParser = require('body-parser'); const rp = require('request-promise'); const Promise = require("bluebird"); +const responseTime = require('response-time') const app = express() /* Global Variables */ @@ -47,6 +48,9 @@ app.use(bodyParser.urlencoded({ // to support URL-encoded bodies extended: true })); +// Create a middleware that adds a X-Response-Time header to responses +app.use(responseTime()); + /* Launch app */ app.listen(app.get('port'), () => console.log(`RiotAPI app listening on port ${app.get('port')}!`))