From 2152b1ff6d6402cf3de2c565e013452c2fb8f036 Mon Sep 17 00:00:00 2001 From: Revanth <109272714+revanth1718@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:12:12 +0530 Subject: [PATCH 1/3] Trivia API --- Trivia API/README.md | 17 +++++++++++ Trivia API/index.html | 31 ++++++++++++++++++++ Trivia API/index.js | 57 ++++++++++++++++++++++++++++++++++++ Trivia API/manifest.json | 15 ++++++++++ Trivia API/package-lock.json | 45 ++++++++++++++++++++++++++++ Trivia API/package.json | 15 ++++++++++ Trivia API/style.css | 52 ++++++++++++++++++++++++++++++++ 7 files changed, 232 insertions(+) create mode 100644 Trivia API/README.md create mode 100644 Trivia API/index.html create mode 100644 Trivia API/index.js create mode 100644 Trivia API/manifest.json create mode 100644 Trivia API/package-lock.json create mode 100644 Trivia API/package.json create mode 100644 Trivia API/style.css diff --git a/Trivia API/README.md b/Trivia API/README.md new file mode 100644 index 0000000..46060bf --- /dev/null +++ b/Trivia API/README.md @@ -0,0 +1,17 @@ +# Trivia API Viewer App + +A simple web application to interact with the Trivia API and view trivia questions. + +## Features +- Fetch and display trivia questions +- Deploy new trivia apps +- Scale trivia app resources +- Retrieve logs from trivia apps + +## Installation +1. Clone the repository: + ```bash + git clone https://github.com/username/TriviaAPIApp.git + +## Contributor +### Revanth \ No newline at end of file diff --git a/Trivia API/index.html b/Trivia API/index.html new file mode 100644 index 0000000..a56a1db --- /dev/null +++ b/Trivia API/index.html @@ -0,0 +1,31 @@ + + + + + + + Trivia API Viewer + + +

Trivia API Viewer

+
+

Trivia Questions

+
+

Deploy

+ + + +

Scale

+ + + + +

Logs

+ + + +
+ + + + diff --git a/Trivia API/index.js b/Trivia API/index.js new file mode 100644 index 0000000..b23732f --- /dev/null +++ b/Trivia API/index.js @@ -0,0 +1,57 @@ +document.addEventListener('DOMContentLoaded', function () { + fetchTriviaQuestions(); + + document.getElementById('deployButton').addEventListener('click', async () => { + const appName = document.getElementById('deployAppName').value; + const sourceUrl = document.getElementById('deploySourceUrl').value; + const response = await fetch('/deploy', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ app_name: appName, source_url: sourceUrl }) + }); + const result = await response.json(); + console.log(result); + }); + + document.getElementById('scaleButton').addEventListener('click', async () => { + const appName = document.getElementById('scaleAppName').value; + const dynoType = document.getElementById('scaleDynoType').value; + const quantity = document.getElementById('scaleQuantity').value; + const response = await fetch('/scale', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ app_name: appName, dyno_type: dynoType, quantity: parseInt(quantity) }) + }); + const result = await response.json(); + console.log(result); + }); + + document.getElementById('logsButton').addEventListener('click', async () => { + const appName = document.getElementById('logsAppName').value; + const response = await fetch(`/logs?app_name=${appName}`); + const result = await response.json(); + const results = document.getElementById('results'); + results.innerHTML = JSON.stringify(result, null, 2); + }); +}); + +async function fetchTriviaQuestions() { + const endpoint = 'https://opentdb.com/api.php?amount=5'; + + fetch(endpoint) + .then(response => response.json()) + .then(data => { + const triviaQuestions = document.getElementById('triviaQuestions'); + data.results.forEach(question => { + const questionItem = document.createElement('div'); + questionItem.className = 'questionItem'; + questionItem.innerHTML = ` +

${question.question}

+

Category: ${question.category}

+

Difficulty: ${question.difficulty}

+ `; + triviaQuestions.appendChild(questionItem); + }); + }) + .catch(error => console.error('Error fetching trivia questions:', error)); +} diff --git a/Trivia API/manifest.json b/Trivia API/manifest.json new file mode 100644 index 0000000..29047ea --- /dev/null +++ b/Trivia API/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "TriviaApp", + "name": "Trivia API Viewer App", + "icons": [ + { + "src": "icon.png", + "type": "image/png", + "sizes": "192x192" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/Trivia API/package-lock.json b/Trivia API/package-lock.json new file mode 100644 index 0000000..a370192 --- /dev/null +++ b/Trivia API/package-lock.json @@ -0,0 +1,45 @@ +{ + "name": "trivia-api-app", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-G7fYv8zS0D7ftu3gnLsOniwhgLU4k9v+1NEtFPP07/Oa8XJ51FtdUKLqIvsTcZo5ua23NO4s9Hr77BM19DOf1g==", + "requires": { + "accepts": "1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "finalhandler": "1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "2.0.6", + "qs": "6.7.0", + "range-parser": "1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "1.5.0", + "type-is": "1.6.18", + "utils-merge": "1.0.1", + "vary": "1.1.2" + } + } + } + } + \ No newline at end of file diff --git a/Trivia API/package.json b/Trivia API/package.json new file mode 100644 index 0000000..fa4b92f --- /dev/null +++ b/Trivia API/package.json @@ -0,0 +1,15 @@ +{ + "name": "trivia-api-app", + "version": "1.0.0", + "description": "A simple app to view Trivia questions", + "main": "index.js", + "scripts": { + "start": "node server.js" + }, + "author": "Your Name", + "license": "ISC", + "dependencies": { + "express": "^4.17.1" + } + } + \ No newline at end of file diff --git a/Trivia API/style.css b/Trivia API/style.css new file mode 100644 index 0000000..17f4543 --- /dev/null +++ b/Trivia API/style.css @@ -0,0 +1,52 @@ +body { + font-family: Arial, sans-serif; + background: linear-gradient(135deg, #89fffd, #ef32d9); + color: #fff; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; +} + +h1 { + font-size: 2.5em; + margin-bottom: 20px; +} + +#app { + text-align: center; + padding: 20px; + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} + +h2 { + margin-top: 20px; + font-size: 1.5em; +} + +input, button { + margin: 10px 0; + padding: 10px; + border-radius: 5px; + border: none; +} + +button { + background: #ef32d9; + color: #fff; + cursor: pointer; +} + +button:hover { + background: #a726c1; +} + +#triviaQuestions .questionItem { + margin-bottom: 15px; +} + +#results { + margin-top: 20px; +} From 1dd0af1874f1a5ab968ed860152e1587eb9df8ed Mon Sep 17 00:00:00 2001 From: Revanth <109272714+revanth1718@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:12:38 +0530 Subject: [PATCH 2/3] Delete Trivia API directory --- Trivia API/README.md | 17 ----------- Trivia API/index.html | 31 -------------------- Trivia API/index.js | 57 ------------------------------------ Trivia API/manifest.json | 15 ---------- Trivia API/package-lock.json | 45 ---------------------------- Trivia API/package.json | 15 ---------- Trivia API/style.css | 52 -------------------------------- 7 files changed, 232 deletions(-) delete mode 100644 Trivia API/README.md delete mode 100644 Trivia API/index.html delete mode 100644 Trivia API/index.js delete mode 100644 Trivia API/manifest.json delete mode 100644 Trivia API/package-lock.json delete mode 100644 Trivia API/package.json delete mode 100644 Trivia API/style.css diff --git a/Trivia API/README.md b/Trivia API/README.md deleted file mode 100644 index 46060bf..0000000 --- a/Trivia API/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Trivia API Viewer App - -A simple web application to interact with the Trivia API and view trivia questions. - -## Features -- Fetch and display trivia questions -- Deploy new trivia apps -- Scale trivia app resources -- Retrieve logs from trivia apps - -## Installation -1. Clone the repository: - ```bash - git clone https://github.com/username/TriviaAPIApp.git - -## Contributor -### Revanth \ No newline at end of file diff --git a/Trivia API/index.html b/Trivia API/index.html deleted file mode 100644 index a56a1db..0000000 --- a/Trivia API/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Trivia API Viewer - - -

Trivia API Viewer

-
-

Trivia Questions

-
-

Deploy

- - - -

Scale

- - - - -

Logs

- - - -
- - - - diff --git a/Trivia API/index.js b/Trivia API/index.js deleted file mode 100644 index b23732f..0000000 --- a/Trivia API/index.js +++ /dev/null @@ -1,57 +0,0 @@ -document.addEventListener('DOMContentLoaded', function () { - fetchTriviaQuestions(); - - document.getElementById('deployButton').addEventListener('click', async () => { - const appName = document.getElementById('deployAppName').value; - const sourceUrl = document.getElementById('deploySourceUrl').value; - const response = await fetch('/deploy', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ app_name: appName, source_url: sourceUrl }) - }); - const result = await response.json(); - console.log(result); - }); - - document.getElementById('scaleButton').addEventListener('click', async () => { - const appName = document.getElementById('scaleAppName').value; - const dynoType = document.getElementById('scaleDynoType').value; - const quantity = document.getElementById('scaleQuantity').value; - const response = await fetch('/scale', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ app_name: appName, dyno_type: dynoType, quantity: parseInt(quantity) }) - }); - const result = await response.json(); - console.log(result); - }); - - document.getElementById('logsButton').addEventListener('click', async () => { - const appName = document.getElementById('logsAppName').value; - const response = await fetch(`/logs?app_name=${appName}`); - const result = await response.json(); - const results = document.getElementById('results'); - results.innerHTML = JSON.stringify(result, null, 2); - }); -}); - -async function fetchTriviaQuestions() { - const endpoint = 'https://opentdb.com/api.php?amount=5'; - - fetch(endpoint) - .then(response => response.json()) - .then(data => { - const triviaQuestions = document.getElementById('triviaQuestions'); - data.results.forEach(question => { - const questionItem = document.createElement('div'); - questionItem.className = 'questionItem'; - questionItem.innerHTML = ` -

${question.question}

-

Category: ${question.category}

-

Difficulty: ${question.difficulty}

- `; - triviaQuestions.appendChild(questionItem); - }); - }) - .catch(error => console.error('Error fetching trivia questions:', error)); -} diff --git a/Trivia API/manifest.json b/Trivia API/manifest.json deleted file mode 100644 index 29047ea..0000000 --- a/Trivia API/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "short_name": "TriviaApp", - "name": "Trivia API Viewer App", - "icons": [ - { - "src": "icon.png", - "type": "image/png", - "sizes": "192x192" - } - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/Trivia API/package-lock.json b/Trivia API/package-lock.json deleted file mode 100644 index a370192..0000000 --- a/Trivia API/package-lock.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "trivia-api-app", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-G7fYv8zS0D7ftu3gnLsOniwhgLU4k9v+1NEtFPP07/Oa8XJ51FtdUKLqIvsTcZo5ua23NO4s9Hr77BM19DOf1g==", - "requires": { - "accepts": "1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "1.1.2", - "encodeurl": "1.0.2", - "escape-html": "1.0.3", - "etag": "1.8.1", - "finalhandler": "1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "1.1.2", - "on-finished": "2.3.0", - "parseurl": "1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.6", - "qs": "6.7.0", - "range-parser": "1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "1.5.0", - "type-is": "1.6.18", - "utils-merge": "1.0.1", - "vary": "1.1.2" - } - } - } - } - \ No newline at end of file diff --git a/Trivia API/package.json b/Trivia API/package.json deleted file mode 100644 index fa4b92f..0000000 --- a/Trivia API/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "trivia-api-app", - "version": "1.0.0", - "description": "A simple app to view Trivia questions", - "main": "index.js", - "scripts": { - "start": "node server.js" - }, - "author": "Your Name", - "license": "ISC", - "dependencies": { - "express": "^4.17.1" - } - } - \ No newline at end of file diff --git a/Trivia API/style.css b/Trivia API/style.css deleted file mode 100644 index 17f4543..0000000 --- a/Trivia API/style.css +++ /dev/null @@ -1,52 +0,0 @@ -body { - font-family: Arial, sans-serif; - background: linear-gradient(135deg, #89fffd, #ef32d9); - color: #fff; - display: flex; - justify-content: center; - align-items: center; - height: 100vh; - margin: 0; -} - -h1 { - font-size: 2.5em; - margin-bottom: 20px; -} - -#app { - text-align: center; - padding: 20px; - background: rgba(0, 0, 0, 0.5); - border-radius: 10px; -} - -h2 { - margin-top: 20px; - font-size: 1.5em; -} - -input, button { - margin: 10px 0; - padding: 10px; - border-radius: 5px; - border: none; -} - -button { - background: #ef32d9; - color: #fff; - cursor: pointer; -} - -button:hover { - background: #a726c1; -} - -#triviaQuestions .questionItem { - margin-bottom: 15px; -} - -#results { - margin-top: 20px; -} From c9a75f3e26930f164994c30547d59f8ad4639bdb Mon Sep 17 00:00:00 2001 From: Revanth <109272714+revanth1718@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:13:07 +0530 Subject: [PATCH 3/3] Trivia API --- New_APIs/Trivia API/README.md | 17 ++++++++ New_APIs/Trivia API/index.html | 31 +++++++++++++++ New_APIs/Trivia API/index.js | 57 +++++++++++++++++++++++++++ New_APIs/Trivia API/manifest.json | 15 +++++++ New_APIs/Trivia API/package-lock.json | 45 +++++++++++++++++++++ New_APIs/Trivia API/package.json | 15 +++++++ New_APIs/Trivia API/style.css | 52 ++++++++++++++++++++++++ 7 files changed, 232 insertions(+) create mode 100644 New_APIs/Trivia API/README.md create mode 100644 New_APIs/Trivia API/index.html create mode 100644 New_APIs/Trivia API/index.js create mode 100644 New_APIs/Trivia API/manifest.json create mode 100644 New_APIs/Trivia API/package-lock.json create mode 100644 New_APIs/Trivia API/package.json create mode 100644 New_APIs/Trivia API/style.css diff --git a/New_APIs/Trivia API/README.md b/New_APIs/Trivia API/README.md new file mode 100644 index 0000000..46060bf --- /dev/null +++ b/New_APIs/Trivia API/README.md @@ -0,0 +1,17 @@ +# Trivia API Viewer App + +A simple web application to interact with the Trivia API and view trivia questions. + +## Features +- Fetch and display trivia questions +- Deploy new trivia apps +- Scale trivia app resources +- Retrieve logs from trivia apps + +## Installation +1. Clone the repository: + ```bash + git clone https://github.com/username/TriviaAPIApp.git + +## Contributor +### Revanth \ No newline at end of file diff --git a/New_APIs/Trivia API/index.html b/New_APIs/Trivia API/index.html new file mode 100644 index 0000000..a56a1db --- /dev/null +++ b/New_APIs/Trivia API/index.html @@ -0,0 +1,31 @@ + + + + + + + Trivia API Viewer + + +

Trivia API Viewer

+
+

Trivia Questions

+
+

Deploy

+ + + +

Scale

+ + + + +

Logs

+ + + +
+ + + + diff --git a/New_APIs/Trivia API/index.js b/New_APIs/Trivia API/index.js new file mode 100644 index 0000000..b23732f --- /dev/null +++ b/New_APIs/Trivia API/index.js @@ -0,0 +1,57 @@ +document.addEventListener('DOMContentLoaded', function () { + fetchTriviaQuestions(); + + document.getElementById('deployButton').addEventListener('click', async () => { + const appName = document.getElementById('deployAppName').value; + const sourceUrl = document.getElementById('deploySourceUrl').value; + const response = await fetch('/deploy', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ app_name: appName, source_url: sourceUrl }) + }); + const result = await response.json(); + console.log(result); + }); + + document.getElementById('scaleButton').addEventListener('click', async () => { + const appName = document.getElementById('scaleAppName').value; + const dynoType = document.getElementById('scaleDynoType').value; + const quantity = document.getElementById('scaleQuantity').value; + const response = await fetch('/scale', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ app_name: appName, dyno_type: dynoType, quantity: parseInt(quantity) }) + }); + const result = await response.json(); + console.log(result); + }); + + document.getElementById('logsButton').addEventListener('click', async () => { + const appName = document.getElementById('logsAppName').value; + const response = await fetch(`/logs?app_name=${appName}`); + const result = await response.json(); + const results = document.getElementById('results'); + results.innerHTML = JSON.stringify(result, null, 2); + }); +}); + +async function fetchTriviaQuestions() { + const endpoint = 'https://opentdb.com/api.php?amount=5'; + + fetch(endpoint) + .then(response => response.json()) + .then(data => { + const triviaQuestions = document.getElementById('triviaQuestions'); + data.results.forEach(question => { + const questionItem = document.createElement('div'); + questionItem.className = 'questionItem'; + questionItem.innerHTML = ` +

${question.question}

+

Category: ${question.category}

+

Difficulty: ${question.difficulty}

+ `; + triviaQuestions.appendChild(questionItem); + }); + }) + .catch(error => console.error('Error fetching trivia questions:', error)); +} diff --git a/New_APIs/Trivia API/manifest.json b/New_APIs/Trivia API/manifest.json new file mode 100644 index 0000000..29047ea --- /dev/null +++ b/New_APIs/Trivia API/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "TriviaApp", + "name": "Trivia API Viewer App", + "icons": [ + { + "src": "icon.png", + "type": "image/png", + "sizes": "192x192" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/New_APIs/Trivia API/package-lock.json b/New_APIs/Trivia API/package-lock.json new file mode 100644 index 0000000..a370192 --- /dev/null +++ b/New_APIs/Trivia API/package-lock.json @@ -0,0 +1,45 @@ +{ + "name": "trivia-api-app", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-G7fYv8zS0D7ftu3gnLsOniwhgLU4k9v+1NEtFPP07/Oa8XJ51FtdUKLqIvsTcZo5ua23NO4s9Hr77BM19DOf1g==", + "requires": { + "accepts": "1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "finalhandler": "1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "2.0.6", + "qs": "6.7.0", + "range-parser": "1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "1.5.0", + "type-is": "1.6.18", + "utils-merge": "1.0.1", + "vary": "1.1.2" + } + } + } + } + \ No newline at end of file diff --git a/New_APIs/Trivia API/package.json b/New_APIs/Trivia API/package.json new file mode 100644 index 0000000..fa4b92f --- /dev/null +++ b/New_APIs/Trivia API/package.json @@ -0,0 +1,15 @@ +{ + "name": "trivia-api-app", + "version": "1.0.0", + "description": "A simple app to view Trivia questions", + "main": "index.js", + "scripts": { + "start": "node server.js" + }, + "author": "Your Name", + "license": "ISC", + "dependencies": { + "express": "^4.17.1" + } + } + \ No newline at end of file diff --git a/New_APIs/Trivia API/style.css b/New_APIs/Trivia API/style.css new file mode 100644 index 0000000..17f4543 --- /dev/null +++ b/New_APIs/Trivia API/style.css @@ -0,0 +1,52 @@ +body { + font-family: Arial, sans-serif; + background: linear-gradient(135deg, #89fffd, #ef32d9); + color: #fff; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; +} + +h1 { + font-size: 2.5em; + margin-bottom: 20px; +} + +#app { + text-align: center; + padding: 20px; + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} + +h2 { + margin-top: 20px; + font-size: 1.5em; +} + +input, button { + margin: 10px 0; + padding: 10px; + border-radius: 5px; + border: none; +} + +button { + background: #ef32d9; + color: #fff; + cursor: pointer; +} + +button:hover { + background: #a726c1; +} + +#triviaQuestions .questionItem { + margin-bottom: 15px; +} + +#results { + margin-top: 20px; +}