-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/its-kritika/APIVerse
- Loading branch information
Showing
27 changed files
with
3,572 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
body { | ||
width: 300px; | ||
height: 300px; | ||
background: url('Dogs.jpg') no-repeat center center; | ||
background-size: cover; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.container { | ||
padding: 8px; | ||
border-radius: 0.5rem; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
} | ||
.Dog { | ||
display: inline-flex; | ||
margin: auto 10px; | ||
font-size: 1.125rem; | ||
color: #cc8c2b; /* blue-500 */ | ||
border-radius: 0.5rem; | ||
border: 1px solid rgb(236, 229, 128); | ||
padding: 10px; | ||
background-color: white; | ||
} | ||
</style> | ||
<title>Random Dog</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<p id="DogElement" class="Dog">Loading...</p> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "Dog facts", | ||
"version": "0.0.1", | ||
"manifest_version": 2, | ||
"browser_action": { | ||
"default_popup": "index.html", | ||
"default_icon": "Dog.png" | ||
}, | ||
"icons": { | ||
"128": "Dog.png" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Random Dog Facts Extension | ||
|
||
This extension generates a random dog fact whenever it is clicked. | ||
|
||
## Installation Instructions | ||
|
||
1. **Open your browser**: Launch your preferred web browser (e.g., Chrome, Edge). | ||
|
||
2. **Enable Developer Mode**: | ||
- Navigate to the extensions page. You can typically do this by typing `chrome://extensions/` in the address bar for Chrome or `edge://extensions/` for Edge. | ||
- Toggle the **Developer mode** switch in the top right corner of the extensions page. | ||
|
||
3. **Load the Extension**: | ||
- Click on the **Load unpacked** button. | ||
- In the file dialog that appears, navigate to the directory where your project files are located and select the folder containing `manifest.json`. | ||
|
||
4. **Activate the Extension**: | ||
- After loading the extension, an icon will appear in the extensions toolbar. | ||
- Click on this icon to generate and view a random dog fact. | ||
|
||
## Screenshot | ||
|
||
Here is what the extension looks like when activated: | ||
|
||
![Random Dog Facts Extension Screenshot](screenshot.jpg) | ||
|
||
## Project Structure | ||
|
||
- `manifest.json`: The manifest file that contains metadata about the extension. | ||
- `index.html`: The HTML file for the extension's popup interface. | ||
- `script.js`: The JavaScript file that handles the logic to fetch and display random dog facts. | ||
|
||
## Additional Information | ||
|
||
- Ensure all necessary files (`manifest.json`, `index.html`, `script.js`, and any additional assets) are in the same directory. | ||
- If you make any changes to the code, you will need to reload the extension by clicking the reload icon next to the extension on the extensions page. | ||
|
||
--- | ||
|
||
Enjoy your random dog facts! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
fetch('https://dogapi.dog/api/v2/facts') | ||
.then(response => response.json()) | ||
.then(DogData => { | ||
const DogText = DogData.data[0].attributes.body; | ||
const DogElement = document.getElementById('DogElement'); | ||
DogElement.innerHTML = DogText; | ||
}) | ||
.catch(error => console.error('Error fetching the Dog:', error)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;500&display=swap" rel="stylesheet"> | ||
|
||
<link rel="stylesheet" href="./style.css"> | ||
<title>Movie Api</title> | ||
</head> | ||
<body> | ||
<h1>Movie Search API</h1> | ||
<form action=""> | ||
<input type="text" class="search-input" placeholder="search for movie..."> | ||
<button>Search</button> | ||
</form> | ||
<div class="image-container"> | ||
|
||
</div> | ||
|
||
|
||
|
||
<!-- <script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script> --> | ||
<script src="./script.js"></script> | ||
<!-- <script src="./notes.js"></script> --> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const form = document.querySelector('form') | ||
const gallery = document.querySelector('.image-container'); | ||
|
||
|
||
form.addEventListener('submit',(e)=>{ | ||
e.preventDefault(); | ||
let query=form.querySelector('input').value; | ||
form.querySelector('input').value=''; | ||
|
||
if(query==''){ | ||
query="nothing"; | ||
} | ||
tvMazeApi(query); | ||
}) | ||
|
||
async function tvMazeApi(query){ | ||
const res=await fetch(`https://api.tvmaze.com/search/shows?q=${query}`); | ||
const shows=await res.json(); | ||
console.log(shows); | ||
makeImages(shows); | ||
} | ||
|
||
function makeImages(shows) { | ||
for(let show of shows) | ||
{ | ||
if(show.show.image) | ||
{ | ||
console.log(show.show.image.medium); | ||
const img = document.createElement('img'); | ||
img.src=show.show.image.medium; | ||
gallery.append(img); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
min-height: 100vh; | ||
background-color: #000; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
color: #fff; | ||
margin-top: 1rem; | ||
} | ||
|
||
form { | ||
text-align: center; | ||
margin-top: 1rem; | ||
display: flex; | ||
justify-content: center; | ||
gap: 0.5rem; | ||
margin-bottom: 30px; | ||
} | ||
|
||
.search-input { | ||
font-size: 1.2rem; | ||
padding: 0.5em; | ||
border-radius: 0.25rem; | ||
border: none; | ||
outline: none; | ||
background-color: #eaeaea; | ||
transition: box-shadow 0.3s ease; | ||
} | ||
|
||
.search-input:focus { | ||
box-shadow: 0 0 4px 2px rgba(238, 170, 67, 0.8); | ||
} | ||
|
||
button { | ||
font-size: 1rem; | ||
padding: 0.5em 1em; | ||
background-color: #078686; | ||
color: #fff; | ||
border: none; | ||
font-weight: bold; | ||
border-radius: 0.25em; | ||
box-shadow: 1px 1px 2px 2px #636161; | ||
transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; | ||
} | ||
|
||
button:hover { | ||
cursor: pointer; | ||
background-color: rgba(6, 118, 118, 0.85); | ||
} | ||
|
||
button:active { | ||
transform: translate(2px, 2px); | ||
box-shadow: 1px 1px 2px 1px #636161; | ||
} | ||
|
||
img { | ||
display: block; | ||
width: 100%; | ||
box-shadow: 0 0 5px #5d5d5d; | ||
transition: transform 0.3s linear; | ||
cursor: pointer; | ||
overflow: hidden; | ||
} | ||
|
||
img:hover { | ||
transform: scale(1.05); | ||
} | ||
|
||
.image-container { | ||
display: grid; | ||
place-content: center; | ||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); | ||
gap: 20px; | ||
width: 90%; | ||
margin: 10px auto; | ||
} | ||
|
||
@media (max-width: 580px) { | ||
img { | ||
height: 350px; | ||
} | ||
.image-container { | ||
grid-template-columns: repeat(auto-fit, minmax(250px, 300px)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PORT = "" | ||
DATABASE_URL="" | ||
JWT_SECRET="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import dotenv from "dotenv"; | ||
import mongoose from "mongoose"; | ||
|
||
dotenv.config(); | ||
|
||
const uri = process.env.DATABASE_URL; | ||
|
||
mongoose.connect(uri); | ||
|
||
async function connectToDatabase() { | ||
try { | ||
await mongoose.connect(uri); | ||
console.log("Database connected"); | ||
} catch (error) { | ||
console.error("Database connection error:", error); | ||
} | ||
} | ||
|
||
export default connectToDatabase; |
Oops, something went wrong.