Skip to content

Commit

Permalink
wda
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbiDev committed Jun 11, 2024
1 parent ecc76ec commit 84241c9
Show file tree
Hide file tree
Showing 28 changed files with 626 additions and 497 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Unnecessary Libraries

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
107 changes: 96 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,104 @@
## ImDragonsAPI Route
<p align="center">
<a href="#gh-light-mode-only">
<img src="./assets/1.png" alt="logo" width="100%" height="auto" />
</a>
<a href="#gh-dark-mode-only">
<img src="./assets/2.png" alt="logo" width="100%"; height="auto";/>
</a>
</p>
<p align="center">An API that allows for instant access to a massive database of <br> infomation regarding the band Imagine Dragons!</p>
</p>
<p align="center">
<a href="#about">About</a> •
<a href="#prerequisites">The API</a> •
<a href="#links">Links</a> •
<a href="#credits">Credits</a>
</p>

## Main API Route
# 👋 About
Created on April 24th, 2021 by [Unnecessary Libraries](https://github.com/unnecessarylibraries). ImDragonsAPI was created to give fans an all in one place for a fast, and constantly updating database of data regarding the band [Imagine Dragons](https://www.imaginedragonsmusic.com/#/). Instantly giving results back after perfecting the codebase. Say goodbye to the painstaking process of copy and pasting Wikis!

# 💻 The API
ImDragonsAPI was also designed to be a beginner friendly tool for new aspiring developers. A public rest API anyone can use to start gaining skills within backend development. Thats why we developed our database with a very simple to use structure.

Examples projects you can try:
- Making a Discord Data bot that gives Information regarding the band
- Twitter bot that Tweets out upcoming band Events
- Imagine Dragons news website
- Retrieving music streaming services data with the API
- Creating an Imagine Dragons Theme Website to learn front-end and Back-end integration

**...and So much more.**

# 🚀 Usage
There are many different way to use and manipulate our API. Since its a open api, you can access it from about almost anywhere, As long as your enviorment/code supports HTTP requests.

Main API Route
```
https://api.unnecessarylibraries.com/imdragons/v1/public
```
Example of the ```/public/band``` endpoint.
```
https://api.unnecessarylibraries.com/imdragons/v1/
https://api.unnecessarylibraries.com/imdragons/v1/public/band
```

## Current Version
v1.1.1
API Route Response in JSON
```json
{
"BAND_INFO": {
"details": {
"origin": "Las Vegas, Nevada, United States",
"genres": [
"Alternative rock",
"Indie rock",
"Electronic rock"
],
"labels": [
"Interscope Records",
"KIDinaKORNER"
],
"members": [
"Daniel Samardžić",
"Dan Reynolds",
"Ben McKee",
"Wayne Sermon",
"Daniel Platzman"
]
},
"socials": {
"twitter": "https://twitter.com/Imaginedragons",
"youtube": "https://www.youtube.com/channel/UCpx_k19S2vUutWUUM9qmXEg",
"apple": "https://music.apple.com/us/artist/imagine-dragons/358714030",
"spotify": "https://open.spotify.com/artist/53XhwfbYqKCa1cC15pYq2q",
"instagram": "https://www.instagram.com/imaginedragons/",
"website": "https://www.imaginedragonsmusic.com/",
"facebook": "https://www.facebook.com/ImagineDragons/",
"email": "https://www.imaginedragonsmusic.com/#mailing-list"
}
}
}
```

## Documentation
https://docs.unnecessarylibraries.com/
See our dedicated website for our documentation, or you can view our documentation files:
- [Website](https://docs.unnecessarylibraries.com/) (Work in Progress)
- [Files](https://github.com/unnecessarylibraries/ImDragonsAPI/tree/main/docs)

## Supported Languages

| Language | Name | Version | Link |
| ---------- | ------------ | ------- | ------|
| Javascript | ImDragons.JS | v1.0.2 | [Click Here](https://github.com/RobbiDev/imagine-dragons.js)|

Want to help expand our supported libraries? Don't be afraid to develop your own library, or contribute to existing libraries. Look at our contributing policy to learn more about adding your own additions!

# Links
- [Github](https://github.com/unnecessarylibraries)
- [Unnecessary Libraries Discord](https://discord.gg/y8TYje4PXH)

# Credits
- [RobbiDev](https://github.com/pengyofficial) - Lead Programmer
- [Unnecessary Libraries](https://github.com/unnecessarylibraries) - Organizer
- [Imagine Dragons](https://www.imaginedragonsmusic.com/#/) - The Creator of it all

## Gitignore
- node-modules
- package-lock.json

## Package Dependencies
[got](https://www.npmjs.com/package/got)
26 changes: 26 additions & 0 deletions api/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

import express from 'express';

import albumRoutes from './routes/albumRoutes.js';

const app = express();

// Middleware
app.use((req, res, next) => {
res.removeHeader("x-powered-by");
res.removeHeader("set-cookie");
res.removeHeader("Date");
res.removeHeader("Connection");
next();
});

// Routes
app.use('/v2/albums', albumRoutes);

// Error Handling Middleware
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send({ error: 'Something went wrong!' });
});

export default app;
68 changes: 68 additions & 0 deletions api/app2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// // Import necessary modules
// const express = require('express');
// const app = express();
// const config = require('./config.json');
// const builder = require('./fileBuilder.js');

// // Middleware to parse JSON bodies
// app.use(express.json());

// // Global constant for API name
// const apiName = config.apiName;

// // Middleware to remove specific headers for security
// app.use((req, res, next) => {
// res.removeHeader("x-powered-by");
// res.removeHeader("set-cookie");
// res.removeHeader("Date");
// res.removeHeader("Connection");
// next();
// });

// // Maintenance mode middleware
// if (config.maintenance) {
// app.use('*', (req, res) => {
// res.status(503).send({ maintenance: 'Server currently down for maintenance' });
// });
// }

// // Route for public API requests
// app.use(`/${apiName}/v1/public`, builder("main"));

// // Uncomment the following line if you need to add private routes in the future
// // app.use(`/${apiName}/v1/private`, builder("main"));

// // Start the server and listen on the specified port
// app.listen(config.PORT, () => {
// if (config.env.stage) {
// console.log(`Server is in Staging Mode and is running on http://localhost:${config.PORT}`);
// } else {
// console.warn('WARNING: Server is in PRODUCTION Mode! All changes will be live immediately.');
// console.log(`Server is in PRODUCTION Mode and is running on https://api.unnecessarylibraries.com/imdragons/v1/`);
// }
// });

// /**
// * Express.js server application setup
// *
// * This application is configured to run an API server using Express.js. It loads
// * configuration settings from a JSON file and applies various middlewares, including:
// * - JSON body parsing
// * - Security headers removal
// * - Maintenance mode handling
// *
// * The server routes are dynamically built using an external module (`fileBuilder.js`).
// * Depending on the environment and configuration, it can operate in staging or production mode.
// *
// * Configurations:
// * - apiName: The base name for the API routes
// * - maintenance: Boolean flag for enabling maintenance mode
// * - PORT: Port number on which the server listens
// * - env.stage: Boolean flag indicating if the server is in staging mode
// *
// * Routes:
// * - Public routes are prefixed with `/${apiName}/v1/public`
// * - Private routes (currently commented out) can be added as needed
// *
// * The server starts and logs its status based on the environment configuration.
// */
10 changes: 6 additions & 4 deletions server/config.json → api/config/default.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"version": "v1",
"api": "ImDragons",
"PORT": 5000,
"version": "v2",
"maintenance": false,
"env": {
"stage": false,
"name": "staging Envoirment"
},
"PORT": 5000,
"apiName": "ImDragons"
}


}
Loading

0 comments on commit 84241c9

Please sign in to comment.