├── .editorconfig ├── .eslintrc ├── .github └── workflows │ └── node.js.yml ├── .gitignore ├── .prettierrc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Change_log.md ├── GraphQL_Basics.md ├── LICENSE ├── README.md ├── SampleAPI-3.0-Screenshot.png ├── checkdiff.sh ├── client ├── .browserslistrc ├── .editorconfig ├── .eslintrc ├── .gitignore ├── .vscode │ └── settings.json ├── README.md ├── generate-react-cli.json ├── index.html ├── package.json ├── public │ ├── favicon.ico │ ├── images │ │ ├── GraphQL_Structure.png │ │ ├── REST_Structure.png │ │ └── poster.jpg │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ ├── robots.txt │ └── vite.svg ├── src │ ├── App.tsx │ ├── components │ │ ├── APICard │ │ │ ├── APICard.scss │ │ │ └── APICard.tsx │ │ ├── APICategories │ │ │ ├── APICategories.scss │ │ │ └── APICategories.tsx │ │ ├── APIFilter │ │ │ ├── APIFilter.scss │ │ │ └── APIFilter.tsx │ │ ├── APISearch │ │ │ ├── APISearch.scss │ │ │ └── APISearch.tsx │ │ ├── CodepenWrapper │ │ │ ├── CodepenWrapper.scss │ │ │ └── CodepenWrapper.tsx │ │ ├── Endpoints │ │ │ ├── Endpoints.scss │ │ │ └── Endpoints.tsx │ │ ├── Header │ │ │ ├── Header.scss │ │ │ └── Header.tsx │ │ ├── Nav │ │ │ ├── Nav.scss │ │ │ └── Nav.tsx │ │ └── PageHeaderActions │ │ │ ├── PageHeaderActions.scss │ │ │ └── PageHeaderActions.tsx │ ├── context │ │ └── GlobalContext.tsx │ ├── hooks │ │ ├── useFetch.tsx │ │ └── useLocalStorage.tsx │ ├── main.tsx │ ├── pages │ │ ├── APIDetails │ │ │ ├── APIDetails.scss │ │ │ └── APIDetails.tsx │ │ ├── APIList │ │ │ ├── APIList.scss │ │ │ └── APIList.tsx │ │ ├── About │ │ │ ├── About.scss │ │ │ └── About.tsx │ │ ├── Docs │ │ │ ├── Docs.scss │ │ │ └── Docs.tsx │ │ ├── Home │ │ │ ├── Home.scss │ │ │ └── Home.tsx │ │ ├── NotFound │ │ │ ├── NotFound.scss │ │ │ └── NotFound.tsx │ │ └── StyleGuide │ │ │ ├── StyleGuide.scss │ │ │ └── StyleGuide.tsx │ ├── router │ │ └── routes.tsx │ ├── styles │ │ ├── _api-card.scss │ │ ├── _api-categories.scss │ │ ├── _api-endpoints.scss │ │ ├── _api-filter.scss │ │ ├── _api-search.scss │ │ ├── _base.scss │ │ ├── _buttons.scss │ │ ├── _code-display.scss │ │ ├── _custom-properties.scss │ │ ├── _header.scss │ │ ├── _nav.scss │ │ ├── _not-found.scss │ │ ├── _page.scss │ │ ├── _typography.scss │ │ ├── functions │ │ │ ├── _colors.scss │ │ │ ├── _fonts.scss │ │ │ ├── _index.scss │ │ │ └── _screens.scss │ │ ├── mixins │ │ │ └── _colors.scss │ │ ├── styles.scss │ │ └── vars │ │ │ ├── _colors.scss │ │ │ ├── _fonts.scss │ │ │ ├── _index.scss │ │ │ └── _screens.scss │ ├── utils │ │ ├── Config.ts │ │ ├── Enums.ts │ │ ├── Helpers.ts │ │ └── Interfaces.ts │ └── vite-env.d.ts ├── templates │ ├── component │ │ └── TemplateName.tsx │ ├── hooks │ │ └── TemplateName.tsx │ ├── layout │ │ └── TemplateName.tsx │ └── page │ │ └── TemplateName.tsx ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts ├── package-lock.json ├── package.json └── server ├── .vscode └── settings.json ├── GeneratedAPIList.js ├── api ├── avatar.json ├── avatar.json.backup ├── baseball.json ├── baseball.json.backup ├── beers.json ├── beers.json.backup ├── bitcoin.json ├── bitcoin.json.backup ├── cartoons.json ├── cartoons.json.backup ├── codingresources.json ├── codingresources.json.backup ├── coffee.json ├── coffee.json.backup ├── countries.json ├── countries.json.backup ├── csscolornames.json ├── csscolornames.json.backup ├── fakebank.json ├── fakebank.json.backup ├── football.json ├── football.json.backup ├── futurama.json ├── futurama.json.backup ├── health.json ├── health.json.backup ├── jokes.json ├── jokes.json.backup ├── monstersanctuary.json ├── monstersanctuary.json.backup ├── movies.json ├── movies.json.backup ├── playstation.json ├── playstation.json.backup ├── presidents.json ├── presidents.json.backup ├── recipes.json ├── recipes.json.backup ├── rickandmorty.json ├── rickandmorty.json.backup ├── simpsons.json ├── simpsons.json.backup ├── switch.json ├── switch.json.backup ├── thestates.json ├── thestates.json.backup ├── typer.json ├── typer.json.backup ├── wines.json ├── wines.json.backup ├── xbox.json └── xbox.json.backup ├── apiList.js ├── package-lock.json ├── package.json ├── public ├── assets │ ├── images │ │ ├── poster.jpg │ │ ├── poster.psd │ │ └── screenshot-sampleAPI.png │ └── styles │ │ ├── code.css │ │ ├── home-styles.css │ │ └── styles.css └── scripts │ └── CodeHighlight.js ├── routes ├── base-apis.js ├── create-apis.js ├── custom-apis.js ├── frontend.js ├── reset.js └── testApis.js ├── sampleapis.js ├── tests └── apis.test.js ├── utils ├── getAPIListData.js ├── rateLimiterDefaults.js ├── utils.js └── verifyData.js └── views ├── 404-custom.pug ├── 404.pug ├── api-reset.pug ├── create.pug ├── custom.pug ├── index.pug ├── page.pug └── partials └── header.pug /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | max_line_length = 120 11 | quote_type = double 12 | spaces_around_operators = true 13 | spaces_around_brackets = true -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true, 5 | "jquery": true, 6 | "es6": true, 7 | "amd": false, 8 | "commonjs": true 9 | }, 10 | "extends": "eslint:recommended", 11 | "globals": {}, 12 | "parserOptions": { 13 | "ecmaVersion": 2018, 14 | "sourceType": "module" 15 | }, 16 | "rules": { 17 | "indent": [ 18 | "error", 19 | 2 20 | ], 21 | "linebreak-style": [ 22 | "error", 23 | "unix" 24 | ], 25 | "quotes": [ 26 | "error", 27 | "double" 28 | ], 29 | "semi": [ 30 | "error", 31 | "always" 32 | ], 33 | "no-unused-vars": [ 34 | 1, 35 | { 36 | "ignoreRestSiblings": true, 37 | "argsIgnorePattern": "res|next|^err" 38 | } 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [16.x] 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 21 | 22 | steps: 23 | - uses: actions/checkout@v3 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v3 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | cache: 'npm' 29 | - run: cd client 30 | - run: npm run build --if-present 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | _old/ 4 | dist 5 | 6 | data.html 7 | .now 8 | .vs 9 | 10 | 11 | server/custom/* 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | server/.vscode 18 | client/.vscode 19 | client/build 20 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all" 3 | } 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 8 | 9 | ## Our Standards 10 | 11 | Examples of behavior that contributes to a positive environment for our community include: 12 | 13 | - Demonstrating empathy and kindness toward other people 14 | - Being respectful of differing opinions, viewpoints, and experiences 15 | - Giving and gracefully accepting constructive feedback 16 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 17 | - Focusing on what is best not just for us as individuals, but for the overall community 18 | 19 | Examples of unacceptable behavior include: 20 | 21 | - The use of sexualized language or imagery, and sexual attention or 22 | advances of any kind 23 | - Trolling, insulting or derogatory comments, and personal or political attacks 24 | - Public or private harassment 25 | - Publishing others' private information, such as a physical or email 26 | address, without their explicit permission 27 | - Other conduct which could reasonably be considered inappropriate in a 28 | professional setting 29 | 30 | ## Enforcement Responsibilities 31 | 32 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 33 | 34 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 35 | 36 | ## Scope 37 | 38 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 39 | 40 | ## Enforcement 41 | 42 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. 43 | 44 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 45 | 46 | ## Enforcement Guidelines 47 | 48 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 49 | 50 | ### 1. Correction 51 | 52 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 53 | 54 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 55 | 56 | ### 2. Warning 57 | 58 | **Community Impact**: A violation through a single incident or series of actions. 59 | 60 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 61 | 62 | ### 3. Temporary Ban 63 | 64 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 65 | 66 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 67 | 68 | ### 4. Permanent Ban 69 | 70 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 71 | 72 | **Consequence**: A permanent ban from any sort of public interaction within the community. 73 | 74 | ## Attribution 75 | 76 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 77 | 78 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 79 | 80 | [homepage]: https://www.contributor-covenant.org 81 | 82 | For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq). Translations are available at [translations page](https://www.contributor-covenant.org/translations). 83 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Sample APIs 2 | 3 | Thanks for taking the time to contribute! 4 | 5 | The following is a set of guidelines for contributing to this project. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request. 6 | 7 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests. 8 | 9 | When contributing to this repository, please first discuss the change you wish to make via an [issue](https://github.com/jermbo/SampleAPIs/issues) with the owners of this repository before making a change. 10 | 11 | ## Code of Conduct 12 | 13 | Before we get any further, please take the time to review our [Code of Conduct](https://github.com/jermbo/SampleAPIs/blob/master/CODE_OF_CONDUCT.md). This project and everyone participating in it will be governed by the [Code of Conduct](https://github.com/jermbo/SampleAPIs/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to us. Be polite to everyone. If you are not in your best day, take a deep breath and try again. Smile 😄! 14 | 15 | ## New Issues 16 | 17 | Before you submit an issue: 18 | 19 | - Search the current list of issues, bug reports, or feature requests. 20 | - If the issue already exists, add a 👍 or a ❤️, and you can click the `Subscribe` or `Watching` button to get notifications via email. 21 | - Please, do not use the issue tracker for support questions. 22 | 23 | ## Contributing 24 | 25 | When you are looking for an issue to work on: 26 | 27 | - Search the current list of issues, bug reports, or feature requests. 28 | - When you find something you are interested in and assign it to you. 29 | - Give it a label of `Doing`. 30 | - Create a branch with issue number and title. ( ie. `1-create-contributing-documentation`) 31 | - Make the changes in your branch. 32 | - Submit a PR to `main` branch when ready. ( Please follow PR Comment Guide ) 33 | 34 | ## PR Comment Guide 35 | 36 | The title of the pull request should contain only the issue number and issue title. ( ie `#1 Create Contributing Documentation`) 37 | 38 | The body's first line should be a link to the issue for quick reference. The rest of the body should be a brief explanation of what changes were made. Each issue should have a list for Acceptance Criteria, this should be addressed in the PR comment. 39 | 40 | ## Code Review Process 41 | 42 | The core team looks a Pull Request on a regular basis. Each PR will be reviewed and tested. Feedback will be provided via file comments or general comments. We will be clear if further action is required. It is the contributors responsibility their code does not have breaking changes or merge conflicts. 43 | 44 | ## Example of adding a new Endpoint 45 | 46 | Our project is all about great data to play with! 47 | And I know of no one better than YOU (yes YOU) that knows what data YOU'D like to play with. 48 | 49 | In this section we'll learn how to add a new dataset (or "endpoint" as we'll call them) 50 | 51 | Each endpoint needs three files. Here's a [example of a new PR adding just a new endpoint](https://github.com/jermbo/SampleAPIs/pull/89) 52 | 53 | Here are the official steps to add an endpoint 54 | 1) Create a endpointName.json file (eg. baseball.json for `api.SampleApis.com/baseball`) with a value for each "collection" (so for "homeRuns" we end up with `https://api.sampleapis.com/baseball/homeRuns` because there's a array for the parameter "homeRuns" see [api/baseball.json](/server/api/baseball.json) for more details) 55 | 2) Create a ".backup" file which is a copy of the original endpointName.json file (in our example it would be [baseball.json.backup](/server/api/baseball.json.backup) ) 56 | 3) Ensure you newly created json file has a `metaData` key at the top of the file. 57 | 58 | The JSON file should look something like: 59 | ```JavaScript 60 | { 61 | "metaData": [ 62 | { 63 | "title": "", // The display title of the data 64 | "desc": "", // A short explanation about this data 65 | "longDesc": "", // A longer explanation about this data 66 | "featured": false, // This should always be false to start with 67 | "categories": [] // An array of strings for whatever categories fit your data 68 | } 69 | ], 70 | "dataset1": [...], 71 | "dataset2": [...], 72 | "dataset3": [...], 73 | } 74 | ``` 75 | 76 | ### How the system works 77 | 78 | Under the hood we are utilizing [JSON-Server](https://www.npmjs.com/package/json-server) and [JSON-GraphQL-Server](https://www.npmjs.com/package/json-graphql-server), so all the features, and limitations, that come with those projects apply here. 79 | 80 | #### Data Structure 81 | 82 | The first level children of the JSON Object will be your main entry points for the server. For example: 83 | 84 | ```JavaScript 85 | // Fav-Show.json 86 | { 87 | "metaData": [...], 88 | "characters": [...], 89 | "questions": [...], 90 | "inventory": [...], 91 | } 92 | ``` 93 | 94 | This API will have `characters`, `questions`, and `inventory` for its available sources. Resulting in `https://api.sampleapis.com/fav-show/characters`, `https://api.sampleapis.com/fav-show/questions`, and `https://api.sampleapis.com/fav-show/inventory`. 95 | 96 | ***We strip out `metaData` from the available endpoints list, as we use this for populating the website. But you can still reach the data if you wanted to.*** 97 | 98 | *Important:* JSON GraphQL Server requires the data in the first level keys be an array of objects. The objects in the array can be whatever they need to be, and they need to be consistent. 99 | 100 | *Important:* Both JSON Server and JSON GraphQL Server requires each object in the dataset have a unique id. 101 | -------------------------------------------------------------------------------- /Change_log.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## v3.0-beta-1 4 | 5 | *BREAKING CHANGES!!* 6 | All api's have been moved to `api.sampleapis.com/[ENDPOINT]/[DATA]`. For example, `api.sampleapis.com/futurama/characters`. If you have applications currently using the old way, you will need to update. 7 | 8 | ### Separation of Front and Back ends 9 | In order to move forward with some planned features, there needed to be a separation between the front and back ends. The back end is strictly an express endpoint application supplying the data necessary to the front end and apis. The front end is a React application, utilizing standard CRA and best practices. ( At lease the best practices I could find. ) 10 | 11 | ### API List has been removed 12 | In the old application, we needed to updated the `APIList.js` to get the data to show up. This is no more. Now, when submitting a new endpoint, you will need to include a `metadata` object to the json file. This is what powers the system and was intended to make life a little easier / programmatic. 13 | 14 | ## v2.8.0 15 | 16 | Foundation for user created endpoints. This feature is still in beta and not promoted on the site. Users can manually access the link by going to `.com/create`. Here the user will need to enter a group name and provide a list of endpoints to create the first file. 17 | 18 | More improvements will be made in the near future. 19 | 20 | ## v2.7.0 21 | 22 | Custom 404 Pages. 23 | 24 | ## v2.6.0 25 | 26 | In anticipation of being utilized more, we have put in a rate limiter based on IP address. Right now the rate limit is 500 every 5 minutes. This can be adjusted based on user feedback. 27 | 28 | ## v2.5.0 29 | 30 | After trying several hosts, SampleAPIs is now being self hosted. By doing this we now gain back all the CURD ability we lost being on a static host. 31 | 32 | ## v2.0.0 33 | 34 | Version 2.0.0 35 | 36 | ### Express 37 | 38 | We have introduced the proper use of Express.js and embraced the Pug.js template engine to gain maximum efficiency in our work stream. 39 | 40 | ### APIList.js 41 | 42 | APIList.js is now our single source of truth, running both the backend urls as well as the frontend visualizations. 43 | 44 | This object is being passed into individual pages to provide the information necessary to a given set of data. The notable change here is the inclusion of the endpoint available. Before the system would read the json file and make the buttons accordingly. Again, do to the way Express and JSONServer interact with each other we are forced to explicitly name the available endpoints. 45 | 46 | ```JavaScript 47 | { 48 | id: 1, 49 | title: "Futurama", 50 | longDesc: "If you are a Futurama fan, then this api is for you. Here you can find everything from Episodes to Characters to Trivia Questions, and even some of the Products featured on the show.", 51 | desc: "An API with characters, episode listing, species, planets, and trivia questions.", 52 | link: "futurama", 53 | endPoints: [ 54 | "info", 55 | "characters", 56 | "cast", 57 | "episodes", 58 | "questions", 59 | "inventory" 60 | ] 61 | } 62 | ``` 63 | 64 | ### API Folder 65 | 66 | The biggest change has been the API folder. The same `db.json` and `db.json.backup` file structure exists, but they are no longer associated with a folder and individualized markup and css. 67 | 68 | You will notice the ulr to get data has changed slightly. `https://sampleapis.com/DATABASE/api/ENDPOINT` This is due to the way Express and JSONServer interact with each other. 69 | -------------------------------------------------------------------------------- /GraphQL_Basics.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

GraphQL

4 |

5 | 6 | ### About : 7 | 8 | This documentation will cover the basics of GraphQL API's. It will include why and when to use GraphQL API's. In this documentation we will cover GraphQL examples with Node.js and Express. 9 | 10 | ## What is GraphQL ? 11 | GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. It has many advantages over REST API's while used with large scale applications. It allows the developer to get exactly the data they want without overfetching or underfetching. 12 | 13 | ## GraphQL vs REST Structure 14 | Below you can see the difference between REST and GraphQL API Structures. It's important to understand how REST works to see the benefits of GraphQL. As it is seen GraphQL can only perform POST requests and to update data it uses mutations. 15 | 16 | GraphQL: 17 | 18 | 19 | REST: 20 | 21 | ## GraphQL Elements 22 | GraphQL has some different keywords then REST. These are: 23 | - Schema 24 | - TypeDefs 25 | - Queries 26 | - Muations 27 | 28 | ### Sample JSON Data 29 | This JSON file is going to be act as a database. 30 | ```jsx 31 | [ 32 | {"id":1,"pizza_name":"Cheese Pizza", "price": "10$", "ingredients":["Mushrooms","Olives","Extra Cheese"]}, 33 | {"id":2,"pizza_name":"Pepperoni Pizza", "price": "12$", "ingredients":["Pepperoni","Mushrooms","Olives"]}, 34 | {"id":3,"pizza_name":"Veggie Pizza", "price": "15$", "ingredients":["Mushrooms","Olives","Green Peppers","Onions","Extra Cheese"]}, 35 | {"id":4,"pizza_name":"Meat Pizza", "price": "20$", "ingredients":["Pepperoni","Mushrooms","Olives","Sausage","Black Olives","Green Peppers","Onions","Extra Cheese"]}, 36 | {"id":5,"pizza_name":"Margherita Pizza", "price": "10$", "ingredients":["Olives","Sausage","Black Olives"]}, 37 | {"id":6,"pizza_name":"BBQ Chicken Pizza", "price": "18$", "ingredients":["Chicken","Mushrooms","Olives","Sausage","Black Olives","Green Peppers","Onions","Extra Cheese"]}, 38 | {"id":7,"pizza_name":"Hawaiian Pizza", "price": "16$", "ingredients":["Mushrooms","Olives","Sausage","Black Olives","Green Peppers","Onions","Extra Cheese"]} 39 | ] 40 | ``` 41 | ### Schema 42 | Schema is the place where the queries and mutations are stored. Both the front-end and back-end team can look at the schema and understand the API. 43 | 44 | You can see an example schema down below with express and GraphQL. 45 | ```jsx 46 | const Query = new GraphQLObjectType({...}); 47 | const Mutation = new GraphQLObjectType({...}); 48 | 49 | //Schema 50 | const schema = new GraphQLSchema({ 51 | query: Query, 52 | mutation: Mutation, 53 | }); 54 | 55 | app.use('/graphql', graphqlHTTP({ 56 | schema, 57 | graphiql: true 58 | })); 59 | ``` 60 | The graphiql boolean allows us to open a in browser API testing app. 61 | 62 | ### Type Defs 63 | Every graph uses a **schema** to define the types of data it includes. You can think of them just like type definitions from Java like **int**, **string**, **float** etc. 64 | ```jsx 65 | const PizzaType = new GraphQLObjectType({ 66 | name: 'Pizza', 67 | fields: { 68 | id: {type: GraphQLInt}, 69 | pizza_name: {type: GraphQLString}, 70 | price: {type: GraphQLString}, 71 | ingredients: {type: GraphQLList(GraphQLString)}, 72 | } 73 | }); 74 | ``` 75 | 76 | ### Queries 77 | Queries allows us to get data from our API. 78 | ```jsx 79 | const Query = new GraphQLObjectType({ 80 | name: 'Query', 81 | fields: { 82 | getAll: { 83 | type: new GraphQLList(PizzaType), 84 | resolve(parent, args) { 85 | return pizzaDB; 86 | } 87 | } 88 | } 89 | }); 90 | ``` 91 | 92 | The great thing about queries is that it allows us to get any data we want. If we want all the data but not the **id** we can do that with just one request in GraphQL and there won't be any unused data so it's going to prevent overfetching. 93 | ```jsx 94 | query { 95 | getAll { 96 | pizza_name 97 | price 98 | ingredients 99 | } 100 | } 101 | ``` 102 | ### Mutations 103 | Mutations allows us to mutate our data. We can use mutations to update, delete and etc. inside our API. In the below example we create a mutation to add a new pizza to our pizza JSON database. 104 | ```jsx 105 | const Mutation = new GraphQLObjectType({ 106 | name: 'Mutation', 107 | fields: { 108 | createNewPizza: { 109 | type: PizzaType, 110 | args: { 111 | pizza_name: {type: GraphQLString}, 112 | price: {type: GraphQLString}, 113 | ingredients: {type: GraphQLList(GraphQLString)} 114 | }, 115 | resolve(parent, args) { 116 | pizzaDB.push({ 117 | id: pizzaDB.length + 1, 118 | pizza_name: args.pizza_name, 119 | price: args.price, 120 | ingredients: args.ingredients 121 | }); 122 | 123 | return args; 124 | } 125 | } 126 | } 127 | }); 128 | ``` 129 | 130 | At below we execute our mutation like this. We don't need to specify the ID since it automatically increases its id to the size of the JSON data. This prevents human error factor. The fallowing query inside of the **createNewPizza** will display the new items that got added. 131 | ```jsx 132 | mutation { 133 | createNewPizza(pizza_name: "New Pizza", price: "0$", ingredients: ["tomato", "pepper", "cheese"]) { 134 | id 135 | pizza_name 136 | price 137 | infredients 138 | } 139 | } 140 | ``` 141 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jeremy "Jermbo" Lawson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sample APIs 3.1 2 | 3 | ![Screenshot](/SampleAPI-3.0-Screenshot.png) 4 | 5 | ## Purpose 6 | 7 | Understanding RESTful APIs is hard enough, even without including an authentication mechanism. The sole purpose of this repository is to play with RESTful endpoints and learn. We have a few endpoints that you can start playing around with right away! If you are not finding anything you are interested in, create your own endpoints and/or submit a pull request. Take a look at the [CONTRIBUTING](https://github.com/jermbo/SampleAPIs/blob/master/CONTRIBUTING.md) for more information on how to get involved. 8 | 9 | # How to use the service 10 | 11 | Choose an endpoint, say "futurama", then choose what information you'd like, say "characters": 12 | ```Javascript 13 | const baseURL = "https://api.sampleapis.com/futurama/characters"; 14 | fetch(baseURL) 15 | .then(resp => resp.json()) 16 | .then(data => console.log(data)); 17 | ``` 18 | 19 | Want to Search? for all chatacters with the name "Bender"? 20 | ```Javascript 21 | const baseURL = "https://api.sampleapis.com/futurama/characters"; 22 | fetch(`${baseURL}?name.first=Bender`) 23 | .then(resp => resp.json()) 24 | .then(data => console.log(data)); 25 | ``` 26 | You also have full CRUD, so you can add information or correct existing ones.

27 | *Note*: Just know that we reset all datapoints weekly and each time we have a new endpoint added. 28 |
29 |
30 | 31 | ## Changes 32 | 33 | Hosting has switched again due to `Vercel.com`'s static nature. The app is being self hosted and is back to being fully CRUD-able. 34 | 35 | Checkout the [Change Log](https://github.com/jermbo/SampleAPIs/blob/master/Change_log.md) for full details. 36 | 37 | ## Disclaimers 38 | 39 | - The data on this site is for educational purposes only and is not owned by SampleAPIs.com 40 | - Data will be reset back to its original state on a regular basis. If you are updating or adding data to the endpoints and want to have them persist as part of the collection, please contribute to the repo by submitting a pull request. 41 | - By using SampleAPIs.com you agree to the following terms: This service is provided under an "as is" condition. It might change or will be discontinued without prior notice. The maker of this service can't be held liable in any way for any reason. 42 | 43 | 44 | ## Recent changes. 45 | Ok. a LOT of work from the great Jermbo, and then a little fluf from TheDamian to make it more pretty! 46 | -------------------------------------------------------------------------------- /SampleAPI-3.0-Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/SampleAPI-3.0-Screenshot.png -------------------------------------------------------------------------------- /checkdiff.sh: -------------------------------------------------------------------------------- 1 | cd server/api 2 | 3 | DIFF=$(diff avatar.json avatar.json.backup) 4 | if [ "$DIFF" != "" ] 5 | then 6 | echo "avatar modified" 7 | fi 8 | DIFF=$(diff baseball.json baseball.json.backup) 9 | if [ "$DIFF" != "" ] 10 | then 11 | echo "baseball modified" 12 | fi 13 | DIFF=$(diff beers.json beers.json.backup) 14 | if [ "$DIFF" != "" ] 15 | then 16 | echo "beers modified" 17 | fi 18 | DIFF=$(diff bitcoin.json bitcoin.json.backup) 19 | if [ "$DIFF" != "" ] 20 | then 21 | echo "bitcoin modified" 22 | fi 23 | DIFF=$(diff cartoons.json cartoons.json.backup) 24 | if [ "$DIFF" != "" ] 25 | then 26 | echo "cartoons modified" 27 | fi 28 | DIFF=$(diff codingresources.json codingresources.json.backup) 29 | if [ "$DIFF" != "" ] 30 | then 31 | echo "codingresources modified" 32 | fi 33 | DIFF=$(diff coffee.json coffee.json.backup) 34 | if [ "$DIFF" != "" ] 35 | then 36 | echo "coffee modified" 37 | fi 38 | DIFF=$(diff countries.json countries.json.backup) 39 | if [ "$DIFF" != "" ] 40 | then 41 | echo "countries modified" 42 | fi 43 | DIFF=$(diff csscolornames.json csscolornames.json.backup) 44 | if [ "$DIFF" != "" ] 45 | then 46 | echo "csscolornames modified" 47 | fi 48 | DIFF=$(diff fakebank.json fakebank.json.backup) 49 | if [ "$DIFF" != "" ] 50 | then 51 | echo "fakebank modified" 52 | fi 53 | DIFF=$(diff football.json football.json.backup) 54 | if [ "$DIFF" != "" ] 55 | then 56 | echo "football modified" 57 | fi 58 | DIFF=$(diff futurama.json futurama.json.backup) 59 | if [ "$DIFF" != "" ] 60 | then 61 | echo "futurama modified" 62 | fi 63 | DIFF=$(diff health.json health.json.backup) 64 | if [ "$DIFF" != "" ] 65 | then 66 | echo "health modified" 67 | fi 68 | DIFF=$(diff jokes.json jokes.json.backup) 69 | if [ "$DIFF" != "" ] 70 | then 71 | echo "jokes modified" 72 | fi 73 | DIFF=$(diff monstersanctuary.json monstersanctuary.json.backup) 74 | if [ "$DIFF" != "" ] 75 | then 76 | echo "monstersanctuary modified" 77 | fi 78 | DIFF=$(diff movies.json movies.json.backup) 79 | if [ "$DIFF" != "" ] 80 | then 81 | echo "movies modified" 82 | fi 83 | DIFF=$(diff playstation.json playstation.json.backup) 84 | if [ "$DIFF" != "" ] 85 | then 86 | echo "playstation modified" 87 | fi 88 | DIFF=$(diff presidents.json presidents.json.backup) 89 | if [ "$DIFF" != "" ] 90 | then 91 | echo "presidents modified" 92 | fi 93 | DIFF=$(diff recipes.json recipes.json.backup) 94 | if [ "$DIFF" != "" ] 95 | then 96 | echo "recipes modified" 97 | fi 98 | DIFF=$(diff rickandmorty.json rickandmorty.json.backup) 99 | if [ "$DIFF" != "" ] 100 | then 101 | echo "rickandmorty modified" 102 | fi 103 | DIFF=$(diff simpsons.json simpsons.json.backup) 104 | if [ "$DIFF" != "" ] 105 | then 106 | echo "simpsons modified" 107 | fi 108 | DIFF=$(diff switch.json switch.json.backup) 109 | if [ "$DIFF" != "" ] 110 | then 111 | echo "switch modified" 112 | fi 113 | DIFF=$(diff thestates.json thestates.json.backup) 114 | if [ "$DIFF" != "" ] 115 | then 116 | echo "thestates modified" 117 | fi 118 | DIFF=$(diff typer.json typer.json.backup) 119 | if [ "$DIFF" != "" ] 120 | then 121 | echo "typer modified" 122 | fi 123 | DIFF=$(diff wines.json wines.json.backup) 124 | if [ "$DIFF" != "" ] 125 | then 126 | echo "wines modified" 127 | fi 128 | DIFF=$(diff xbox.json xbox.json.backup) 129 | if [ "$DIFF" != "" ] 130 | then 131 | echo "xbox modified" 132 | fi 133 | cd ../.. 134 | 135 | -------------------------------------------------------------------------------- /client/.browserslistrc: -------------------------------------------------------------------------------- 1 | [production] 2 | >0.2% 3 | not dead 4 | not op_mini all 5 | 6 | [development] 7 | last 1 chrome version 8 | last 1 firefox version 9 | last 1 safari version 10 | -------------------------------------------------------------------------------- /client/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | max_line_length = 100 11 | quote_type = double 12 | spaces_around_operators = true 13 | spaces_around_brackets = true 14 | -------------------------------------------------------------------------------- /client/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true, 5 | "jquery": true, 6 | "jest": true 7 | }, 8 | "extends": [ 9 | "react-app", 10 | "react-app/jest" 11 | ], 12 | "globals": {}, 13 | "parserOptions": { 14 | "ecmaVersion": 2020, 15 | "sourceType": "module" 16 | }, 17 | "rules": { 18 | "indent": [ 19 | "error", 20 | 2 21 | ], 22 | 23 | "quotes": [ 24 | "error", 25 | "double" 26 | ], 27 | "semi": [ 28 | "error", 29 | "always" 30 | ], 31 | "no-unused-vars": [ 32 | 1, 33 | { 34 | "ignoreRestSiblings": true, 35 | "argsIgnorePattern": "res|next|e|^err|^evt" 36 | } 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | # misc 4 | .DS_Store 5 | dist 6 | dist-ssr 7 | *.local 8 | 9 | .env 10 | .env.local 11 | .env.development.local 12 | .env.test.local 13 | .env.production.local 14 | package-lock.json 15 | 16 | _old -------------------------------------------------------------------------------- /client/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#93e6fc", 4 | "activityBar.activeBorder": "#fa45d4", 5 | "activityBar.background": "#93e6fc", 6 | "activityBar.foreground": "#15202b", 7 | "activityBar.inactiveForeground": "#15202b99", 8 | "activityBarBadge.background": "#fa45d4", 9 | "activityBarBadge.foreground": "#15202b", 10 | "statusBar.background": "#61dafb", 11 | "statusBar.foreground": "#15202b", 12 | "statusBarItem.hoverBackground": "#2fcefa", 13 | "titleBar.activeBackground": "#61dafb", 14 | "titleBar.activeForeground": "#15202b", 15 | "titleBar.inactiveBackground": "#61dafb99", 16 | "titleBar.inactiveForeground": "#15202b99", 17 | "sash.hoverBorder": "#93e6fc", 18 | "statusBarItem.remoteBackground": "#61dafb", 19 | "statusBarItem.remoteForeground": "#15202b", 20 | "commandCenter.border": "#15202b99" 21 | }, 22 | "peacock.color": "#61dafb", 23 | "typescript.tsdk": "node_modules/typescript/lib" 24 | } -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | # Sample APIs - React Application 2 | 3 | ## Generate new templates 4 | 5 | We are utilizing [Generate React CLI](https://github.com/arminbro/generate-react-cli) to help stream line and standardize the process of creating new components for our application. 6 | 7 | We can customized the outputs to fit this applications needs and have expanded the definition of types. Below are a list of commands you can use to create new components, pages, layouts, or hooks. 8 | 9 | ### Component 10 | 11 | By default, we are creating components. Simply run this command and let the CLI take care of the rest. 12 | 13 | ```JavaScript 14 | npx generate-react-cli component [NAME] 15 | ``` 16 | 17 | * Replace `[NAME]` with the desired name. 18 | 19 | ### Page 20 | 21 | When generating a new page, you run the same command but with a `--type` flag of page. 22 | 23 | ```JavaScript 24 | npx generate-react-cli component [NAME] --type=page 25 | ``` 26 | 27 | * Replace `[NAME]` with the desired name. 28 | 29 | ### Layout 30 | 31 | When generating a new layout, you run the same command but with a `--type` flag of layout. 32 | 33 | ```JavaScript 34 | npx generate-react-cli component [NAME] --type=layout 35 | ``` 36 | 37 | * Replace `[NAME]` with the desired name. 38 | 39 | ### Hooks 40 | 41 | Just like everything else, hooks have some boiler plate code as well. To create a new hook, simply the add the `--type` flag of hook/ 42 | 43 | ```JavaScript 44 | npx generate-react-cli component [NAME] --type=hook 45 | ``` 46 | 47 | * Replace `[NAME]` with the desired name. 48 | -------------------------------------------------------------------------------- /client/generate-react-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "usesTypeScript": true, 3 | "usesCssModule": false, 4 | "cssPreprocessor": "scss", 5 | "testLibrary": "None", 6 | "component": { 7 | "default": { 8 | "path": "src/components", 9 | "customTemplates": { 10 | "component": "templates/component/TemplateName.tsx" 11 | }, 12 | "withStyle": true, 13 | "withTest": false, 14 | "withStory": false, 15 | "withLazy": false 16 | }, 17 | "page": { 18 | "path": "src/pages", 19 | "customTemplates": { 20 | "component": "templates/page/TemplateName.tsx" 21 | }, 22 | "withStyle": true, 23 | "withTest": false, 24 | "withStory": false, 25 | "withLazy": false 26 | }, 27 | "layout": { 28 | "path": "src/layout", 29 | "customTemplates": { 30 | "component": "templates/layout/TemplateName.tsx" 31 | }, 32 | "withStyle": true, 33 | "withTest": false, 34 | "withStory": false, 35 | "withLazy": false 36 | }, 37 | "hook": { 38 | "customTemplates": { 39 | "component": "templates/hooks/TemplateName.tsx" 40 | }, 41 | "path": "src/hooks", 42 | "withStyle": false, 43 | "withTest": false, 44 | "withStory": false, 45 | "withLazy": false 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Sample APIs - Helping the world 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 41 | 43 | 44 | 45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-project", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite --open --port=4444", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "@codesandbox/sandpack-react": "^2.13.10", 13 | "@codesandbox/sandpack-themes": "^2.0.21", 14 | "@fortawesome/fontawesome-svg-core": "^6.5.2", 15 | "@fortawesome/free-solid-svg-icons": "^6.5.2", 16 | "@fortawesome/react-fontawesome": "^0.2.2", 17 | "react": "^18.3.1", 18 | "react-dom": "^18.3.1", 19 | "react-router-dom": "^6.23.1", 20 | "sass": "^1.77.2" 21 | }, 22 | "devDependencies": { 23 | "@types/node": "^20.12.12", 24 | "@types/react": "^18.3.3", 25 | "@types/react-dom": "^18.3.0", 26 | "@vitejs/plugin-react-swc": "^3.7.0", 27 | "typescript": "^5.4.5", 28 | "vite": "^5.2.11" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/public/favicon.ico -------------------------------------------------------------------------------- /client/public/images/GraphQL_Structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/public/images/GraphQL_Structure.png -------------------------------------------------------------------------------- /client/public/images/REST_Structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/public/images/REST_Structure.png -------------------------------------------------------------------------------- /client/public/images/poster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/public/images/poster.jpg -------------------------------------------------------------------------------- /client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/public/logo192.png -------------------------------------------------------------------------------- /client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/public/logo512.png -------------------------------------------------------------------------------- /client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Sample APIs", 3 | "name": "Sample Apis", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /client/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { Suspense } from "react"; 2 | 3 | import { Route, Routes } from "react-router-dom"; 4 | import "./styles/styles.scss"; 5 | 6 | import AppRoutes from "./router/routes"; 7 | import Header from "./components/Header/Header"; 8 | 9 | const App: React.FC = () => { 10 | return ( 11 | <> 12 |
13 |
14 | 15 | {AppRoutes.map((route: any) => ( 16 | 21 | 22 | 23 | } 24 | /> 25 | ))} 26 | 27 |
28 | 29 | ); 30 | }; 31 | 32 | export default App; 33 | -------------------------------------------------------------------------------- /client/src/components/APICard/APICard.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/APICard/APICard.scss -------------------------------------------------------------------------------- /client/src/components/APICard/APICard.tsx: -------------------------------------------------------------------------------- 1 | import { faLink, faStar } from "@fortawesome/free-solid-svg-icons"; 2 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; 3 | import React from "react"; 4 | import { Link } from "react-router-dom"; 5 | import { APIData } from "../../utils/Interfaces"; 6 | import APICategories from "../APICategories/APICategories"; 7 | 8 | interface Props { 9 | api: APIData; 10 | featured?: boolean; 11 | } 12 | 13 | const APICard: React.FC = ({ api, featured = false }) => { 14 | return ( 15 |
16 |
17 | 18 |
19 | 20 |

{api.metaData.title}

  21 | 22 | 23 | {featured && ( 24 | 25 | 26 | 27 | )} 28 |
29 |
30 |

{api.metaData.desc}

31 |
32 | See available endpoints 33 |
    34 | {api.endpoints.map((endpoint) => ( 35 |
  • 36 | {endpoint} 37 |
  • 38 | ))} 39 |
40 |
41 |
42 |
43 |
44 | ); 45 | }; 46 | 47 | export default APICard; 48 | -------------------------------------------------------------------------------- /client/src/components/APICategories/APICategories.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/APICategories/APICategories.scss -------------------------------------------------------------------------------- /client/src/components/APICategories/APICategories.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props { 4 | categories: string[]; 5 | } 6 | 7 | const APICategories: React.FC = ({ categories }) => { 8 | return ( 9 | 16 | ); 17 | }; 18 | 19 | export default APICategories; 20 | -------------------------------------------------------------------------------- /client/src/components/APIFilter/APIFilter.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/APIFilter/APIFilter.scss -------------------------------------------------------------------------------- /client/src/components/APIFilter/APIFilter.tsx: -------------------------------------------------------------------------------- 1 | import React, { ChangeEvent } from "react"; 2 | import { upperCase } from "../../utils/Helpers"; 3 | 4 | interface Props { 5 | onChangeHandler: (e: ChangeEvent) => void; 6 | categories: string[]; 7 | } 8 | 9 | const APIFilter: React.FC = ({ onChangeHandler, categories }) => { 10 | return ( 11 |
12 | 20 |
21 | ); 22 | }; 23 | 24 | export default APIFilter; 25 | -------------------------------------------------------------------------------- /client/src/components/APISearch/APISearch.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/APISearch/APISearch.scss -------------------------------------------------------------------------------- /client/src/components/APISearch/APISearch.tsx: -------------------------------------------------------------------------------- 1 | import React, { ChangeEvent } from "react"; 2 | import "./APISearch.scss"; 3 | import { faSearch } from "@fortawesome/free-solid-svg-icons"; 4 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; 5 | 6 | interface Props { 7 | onChangeHandler: (e: ChangeEvent) => void; 8 | } 9 | 10 | const APISearch: React.FC = ({ onChangeHandler }) => { 11 | return ( 12 |
13 |
14 | 15 | 18 |
19 |
20 | ); 21 | }; 22 | 23 | export default APISearch; 24 | -------------------------------------------------------------------------------- /client/src/components/CodepenWrapper/CodepenWrapper.scss: -------------------------------------------------------------------------------- 1 | .CodepenWrapper {} -------------------------------------------------------------------------------- /client/src/components/CodepenWrapper/CodepenWrapper.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | // @ts-ignore 3 | import Codepen from "react-codepen-embed"; 4 | 5 | interface Props { 6 | hash: string; 7 | title: string; 8 | } 9 | 10 | const CodepenWrapper: React.FC = ({ hash, title }) => { 11 | return ( 12 |
13 |

{title}

14 |
Loading...
} 20 | /> 21 |
22 | ); 23 | }; 24 | 25 | export default CodepenWrapper; 26 | -------------------------------------------------------------------------------- /client/src/components/Endpoints/Endpoints.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/Endpoints/Endpoints.scss -------------------------------------------------------------------------------- /client/src/components/Endpoints/Endpoints.tsx: -------------------------------------------------------------------------------- 1 | import React, { Dispatch, SetStateAction, useState } from "react"; 2 | import { URLS } from "../../utils/Config"; 3 | 4 | interface Props { 5 | urlBase: string; 6 | endpoints: string[]; 7 | onEndpointSelect: Dispatch>; 8 | } 9 | 10 | const APIEndpoints: React.FC = ({ urlBase, endpoints, onEndpointSelect }) => { 11 | const [selected, setSelected] = useState("initialState"); 12 | 13 | const showCode = (endpoint: string) => { 14 | console.log(endpoint, selected); 15 | if (endpoint === selected) { 16 | console.log("open now window"); 17 | } else { 18 | setSelected(endpoint); 19 | onEndpointSelect(endpoint); 20 | } 21 | }; 22 | 23 | return ( 24 |
    25 |
  • 26 | 32 | GraphQL 33 | 34 |
  • 35 | {endpoints.map((endpoint) => ( 36 |
  • 37 | 44 |
  • 45 | ))} 46 |
47 | ); 48 | }; 49 | 50 | export default APIEndpoints; 51 | -------------------------------------------------------------------------------- /client/src/components/Header/Header.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/Header/Header.scss -------------------------------------------------------------------------------- /client/src/components/Header/Header.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext } from "react"; 2 | import { Link } from "react-router-dom"; 3 | import { GlobalContext } from "../../context/GlobalContext"; 4 | import Nav from "../Nav/Nav"; 5 | 6 | interface Props {} 7 | 8 | const Header: React.FC = () => { 9 | const { navVisible, setNavVisible } = useContext(GlobalContext); 10 | 11 | const toggleNav = () => { 12 | document.body.classList.toggle("-nav-visible"); 13 | setNavVisible(!navVisible); 14 | }; 15 | 16 | return ( 17 |
18 |

19 | Sample APIs 20 |

21 | 26 |
28 | ); 29 | }; 30 | 31 | export default Header; 32 | -------------------------------------------------------------------------------- /client/src/components/Nav/Nav.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/components/Nav/Nav.scss -------------------------------------------------------------------------------- /client/src/components/Nav/Nav.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect } from "react"; 2 | import { NavLink, useLocation } from "react-router-dom"; 3 | 4 | import { GlobalContext } from "../../context/GlobalContext"; 5 | 6 | const Nav: React.FC = () => { 7 | const { setNavVisible } = useContext(GlobalContext); 8 | 9 | let location = useLocation(); 10 | useEffect(() => { 11 | document.body.classList.remove("-nav-visible"); 12 | setNavVisible(false); 13 | }, [location]); 14 | 15 | const setActive = (navData: { isActive: boolean; isPending: boolean }) => { 16 | return navData.isActive ? "active" : ""; 17 | }; 18 | 19 | return ( 20 |
21 |
    22 |
  • 23 | 24 | Home 25 | 26 |
  • 27 |
  • 28 | 29 | About 30 | 31 |
  • 32 |
  • 33 | 34 | API List 35 | 36 |
  • 37 |
  • 38 | 39 | Docs 40 | 41 |
  • 42 |
43 |
44 | ); 45 | }; 46 | 47 | // export default withRouter(Nav); 48 | export default Nav; 49 | -------------------------------------------------------------------------------- /client/src/components/PageHeaderActions/PageHeaderActions.scss: -------------------------------------------------------------------------------- 1 | .HeaderActions {} -------------------------------------------------------------------------------- /client/src/components/PageHeaderActions/PageHeaderActions.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Link } from "react-router-dom"; 3 | import { faBook, faCodeBranch, faInfoCircle, faList } from "@fortawesome/free-solid-svg-icons"; 4 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; 5 | 6 | interface Props { 7 | currentPage?: string; 8 | } 9 | 10 | const PageHeaderActions: React.FC = ({ currentPage }) => { 11 | const links = [ 12 | { 13 | name: "About", 14 | path: "/about", 15 | icon: faInfoCircle, 16 | show: currentPage === "about", 17 | }, 18 | { 19 | name: "API List", 20 | path: "/api-list", 21 | icon: faList, 22 | show: currentPage === "api-list", 23 | }, 24 | { 25 | name: "Docs", 26 | path: "/docs", 27 | icon: faBook, 28 | show: currentPage === "docs", 29 | }, 30 | ]; 31 | return ( 32 |
33 | {links.map((link) => { 34 | if (link.show) return null; 35 | return ( 36 | 37 | {link.name} 38 | 39 | 40 | ); 41 | })} 42 | 48 | GitHub 49 | 50 | 51 |
52 | ); 53 | }; 54 | 55 | export default PageHeaderActions; 56 | -------------------------------------------------------------------------------- /client/src/context/GlobalContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { createContext, useEffect, useState } from "react"; 2 | import useFetch from "../hooks/useFetch"; 3 | 4 | import { AppStateEnum } from "../utils/Enums"; 5 | import { APIData, APIListResponse, FetchState, iGlobal } from "../utils/Interfaces"; 6 | 7 | export const initialValues: iGlobal = { 8 | navVisible: false, 9 | setNavVisible: () => {}, 10 | apiList: [] as APIData[], 11 | setAPIList: () => [], 12 | appState: AppStateEnum.initial, 13 | setAppState: () => {}, 14 | isLoggedIn: false, 15 | setIsLoggedIn: () => {}, 16 | apiCategories: [], 17 | setApiCategories: () => {}, 18 | }; 19 | 20 | export const GlobalContext = createContext(initialValues); 21 | 22 | interface Props { 23 | children?: React.ReactNode; 24 | } 25 | 26 | const BASE_URL = 27 | process.env.NODE_ENV === "production" ? "https://api.sampleapis.com" : "http://localhost:5555"; 28 | 29 | const GlobalProvider: React.FC = ({ children }) => { 30 | const [navVisible, setNavVisible] = useState(initialValues.navVisible); 31 | const [appState, setAppState] = useState(initialValues.appState); 32 | const [apiList, setAPIList] = useState(initialValues.apiList); 33 | const [isLoggedIn, setIsLoggedIn] = useState(false); 34 | const [apiCategories, setApiCategories] = useState(initialValues.apiCategories); 35 | 36 | const { state: APIState, data } = useFetch>(`${BASE_URL}/frontend`); 37 | 38 | const generateCategories = (list: APIData[]) => { 39 | const allCategories = list.reduce((acc: string[], item) => { 40 | return [...acc, ...item.metaData.categories]; 41 | }, []); 42 | setApiCategories(Array.from(new Set(allCategories))); 43 | }; 44 | 45 | useEffect(() => { 46 | if (APIState === AppStateEnum.ready) { 47 | const list = data?.data?.APIListData || ([] as APIData[]); 48 | setAPIList(list); 49 | generateCategories(list); 50 | return; 51 | } 52 | }, [APIState, data?.data?.APIListData]); 53 | 54 | const values = { 55 | navVisible, 56 | setNavVisible, 57 | apiList, 58 | setAPIList, 59 | appState, 60 | setAppState, 61 | isLoggedIn, 62 | setIsLoggedIn, 63 | apiCategories, 64 | setApiCategories, 65 | }; 66 | return ( 67 | 68 | <>{children} 69 | 70 | ); 71 | }; 72 | 73 | export default GlobalProvider; 74 | -------------------------------------------------------------------------------- /client/src/hooks/useFetch.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import { AppStateEnum } from "../utils/Enums"; 3 | 4 | type ReturnState = { 5 | state: AppStateEnum; 6 | data: T | null; 7 | }; 8 | 9 | function useFetch(url: string): ReturnState { 10 | const [data, setData] = useState(null); 11 | const [state, setState] = useState(AppStateEnum.initial); 12 | 13 | const getData = async () => { 14 | setState(AppStateEnum.loading); 15 | try { 16 | const resp = await fetch(url); 17 | const json = await resp.json(); 18 | setData(json); 19 | setState(AppStateEnum.ready); 20 | } catch (err) { 21 | console.log(err); 22 | setState(AppStateEnum.error); 23 | } 24 | }; 25 | 26 | useEffect(() => { 27 | if (state === AppStateEnum.initial) { 28 | getData(); 29 | } 30 | // eslint-disable-next-line react-hooks/exhaustive-deps 31 | }, []); 32 | 33 | return { state, data }; 34 | } 35 | 36 | export default useFetch; 37 | -------------------------------------------------------------------------------- /client/src/hooks/useLocalStorage.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | 3 | type ReturnType = [T, React.Dispatch>]; 4 | 5 | function useLocalStorageState(key: string, defaultValue: T): ReturnType { 6 | const [state, setState] = useState(() => { 7 | if (!defaultValue) { 8 | return; 9 | } 10 | 11 | try { 12 | const value = localStorage.getItem(key); 13 | return value ? JSON.parse(value) : defaultValue; 14 | } catch (e) { 15 | return defaultValue; 16 | } 17 | }); 18 | 19 | useEffect(() => { 20 | if (state) { 21 | try { 22 | localStorage.setItem(key, JSON.stringify(state)); 23 | } catch (e) { 24 | console.log(e); 25 | } 26 | } 27 | }, [key, state]); 28 | 29 | return [state, setState]; 30 | } 31 | 32 | export default useLocalStorageState; 33 | -------------------------------------------------------------------------------- /client/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { createRoot } from "react-dom/client"; 3 | import { BrowserRouter } from "react-router-dom"; 4 | import GlobalProvider from "./context/GlobalContext"; 5 | import App from "./App"; 6 | 7 | const container = document.getElementById("root"); 8 | const root = createRoot(container!); 9 | 10 | root.render( 11 | 12 | 13 | 14 | 15 | 16 | 17 | , 18 | ); 19 | -------------------------------------------------------------------------------- /client/src/pages/APIDetails/APIDetails.scss: -------------------------------------------------------------------------------- 1 | @use '../../styles/functions/colors'; 2 | 3 | .link { 4 | color: colors.use-var(text, light); 5 | 6 | &:focus, 7 | &:active, 8 | &:hover { 9 | outline: none; 10 | color: colors.use-var(primary); 11 | } 12 | 13 | span { 14 | display: inline-block; 15 | padding: 0 5px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /client/src/pages/APIDetails/APIDetails.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect, useState } from "react"; 2 | import { Link, useParams } from "react-router-dom"; 3 | import APICategories from "../../components/APICategories/APICategories"; 4 | import APIEndpoints from "../../components/Endpoints/Endpoints"; 5 | import { GlobalContext } from "../../context/GlobalContext"; 6 | import { APIData, Example } from "../../utils/Interfaces"; 7 | import { URLS } from "../../utils/Config"; 8 | import { faLink } from "@fortawesome/free-solid-svg-icons"; 9 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; 10 | import "./APIDetails.scss"; 11 | import { Sandpack } from "@codesandbox/sandpack-react"; 12 | import { nightOwl } from "@codesandbox/sandpack-themes"; 13 | 14 | interface Props {} 15 | 16 | const APIDetails: React.FC = () => { 17 | const { id } = useParams(); 18 | const { apiList } = useContext(GlobalContext); 19 | const [singleAPI, setSingleAPI] = useState({} as APIData); 20 | const [singleEndpoint, setSingleEndpoint] = useState(""); 21 | const [thisApiEndpoint, setThisApiEndpoint] = useState(""); 22 | const [exampleList, setExampleList] = useState([]); 23 | 24 | const [codeSample, setCodeSample] = useState(""); 25 | 26 | useEffect(() => { 27 | if (!singleAPI) return; 28 | 29 | const newExampleList = 30 | singleAPI.metaData?.examples?.filter((e) => e.endpoint === singleEndpoint) || []; 31 | setExampleList(newExampleList); 32 | }, [singleAPI, singleEndpoint]); 33 | 34 | useEffect(() => { 35 | const api = apiList.filter((a) => a.name === id)[0]; 36 | setSingleEndpoint(api?.endpoints[0]); 37 | setSingleAPI(api); 38 | }, [id, apiList]); 39 | 40 | useEffect(() => { 41 | if (singleAPI?.link) { 42 | setThisApiEndpoint(`${URLS.API_LINK}/${singleAPI.link}/${singleEndpoint}`); 43 | const sample = `import {useEffect, useState} from 'react'; 44 | 45 | export default function App() { 46 | const [data, setData] = useState(""); 47 | const getData = async () => { 48 | try { 49 | const resp = await fetch('${URLS.API_LINK}/${singleAPI.link}/${singleEndpoint}'); 50 | const json = await resp.json(); 51 | setData(json); 52 | } catch (err) { 53 | setData(err.message); 54 | } 55 | } 56 | 57 | useEffect(() => { 58 | getData(); 59 | }, []); 60 | 61 | return ( 62 |
 63 |       {JSON.stringify(data, null, 2)}
 64 |     
65 | ) 66 | }`; 67 | setCodeSample(sample); 68 | } 69 | }, [singleAPI, singleEndpoint]); 70 | 71 | if (!singleAPI?.metaData) { 72 | return

Loading

; 73 | } 74 | 75 | return ( 76 |
77 |
78 | 79 | Back to List 80 | 81 |

{singleAPI.metaData.title}

82 | 83 |

{singleAPI.metaData.longDesc}

84 |

85 | Endpoint: 86 | 87 | {thisApiEndpoint} 88 | 89 | 90 |

91 |
92 |
93 |
94 |

All other available endpoints

95 | 100 |
101 |
102 | 112 |
113 |
114 |
115 | ); 116 | }; 117 | 118 | export default APIDetails; 119 | -------------------------------------------------------------------------------- /client/src/pages/APIList/APIList.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/pages/APIList/APIList.scss -------------------------------------------------------------------------------- /client/src/pages/APIList/APIList.tsx: -------------------------------------------------------------------------------- 1 | import React, { ChangeEvent, useContext, useEffect, useState } from "react"; 2 | import APICard from "../../components/APICard/APICard"; 3 | import APIFilter from "../../components/APIFilter/APIFilter"; 4 | import APISearch from "../../components/APISearch/APISearch"; 5 | import PageHeaderActions from "../../components/PageHeaderActions/PageHeaderActions"; 6 | import { GlobalContext } from "../../context/GlobalContext"; 7 | 8 | interface Props {} 9 | 10 | const APIList: React.FC = () => { 11 | const { apiList, apiCategories } = useContext(GlobalContext); 12 | const [selectedCategory, setSelectedCategory] = useState("all"); 13 | const [searchWord, setSearchWord] = useState(""); 14 | const [filteredList, setFilteredList] = useState(apiList); 15 | 16 | useEffect(() => { 17 | const categories = apiList.filter((api) => 18 | selectedCategory === "all" ? true : api.metaData.categories.includes(selectedCategory), 19 | ); 20 | 21 | const regex = new RegExp(searchWord, "gi"); 22 | const matches = categories.filter((api) => { 23 | return api.metaData.title.match(regex); 24 | }); 25 | setFilteredList(matches); 26 | }, [apiList, selectedCategory, searchWord]); 27 | 28 | const filterData = (e: ChangeEvent): void => { 29 | setSelectedCategory(e.target.value); 30 | }; 31 | 32 | const searchAPIName = (e: ChangeEvent): void => { 33 | setSearchWord(e.target.value); 34 | }; 35 | 36 | return ( 37 |
38 |
39 |

API List

40 |

41 | Sample APIs has a growing list of{" "} 42 | endpoints. Perfect for any learning 43 | project. 44 |

45 | 46 |
47 |
48 |
49 |

50 | {filteredList.length} APIs 51 |

52 |
53 | 54 | 55 |
56 |
57 |
58 | {filteredList && 59 | filteredList.map((api) => ( 60 | 61 | ))} 62 |
63 |
64 |
65 | ); 66 | }; 67 | 68 | export default APIList; 69 | -------------------------------------------------------------------------------- /client/src/pages/About/About.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/pages/About/About.scss -------------------------------------------------------------------------------- /client/src/pages/About/About.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PageHeaderActions from "../../components/PageHeaderActions/PageHeaderActions"; 3 | 4 | interface Props {} 5 | 6 | const About: React.FC = () => { 7 | return ( 8 |
9 |
10 |

About Sample APIs

11 |

12 | An open source project to help you on your journey of learning{" "} 13 | RESTful or{" "} 14 | GraphQL{" "} 15 | endpoints. 16 |

17 | 18 |
19 |
20 |

21 | Understanding RESTful or{" "} 22 | GraphQL{" "} 23 | APIs is hard enough, even without 24 | including an authentication mechanism. The sole purpose of this website is to play with{" "} 25 | RESTful{" "} 26 | endpoints and learn. We have a few{" "} 27 | endpoints that you can start playing 28 | around with right away! If you are not finding anything you are interested in, create your 29 | own endpoints and submit a pull request. 30 |

31 |

32 | You can use any HTTP verbs (GET, POST, 33 | PUT, PATCH and DELETE) and access your resources from anywhere using{" "} 34 | CORS and{" "} 35 | JSONP. 36 |

37 |
38 |
39 | ); 40 | }; 41 | 42 | export default About; 43 | -------------------------------------------------------------------------------- /client/src/pages/Docs/Docs.scss: -------------------------------------------------------------------------------- 1 | .Docs {} 2 | 3 | 4 | .section { 5 | margin-top: 50px; 6 | } 7 | 8 | pre { 9 | background-color: #f4f4f4; 10 | padding: 10px; 11 | border-radius: 5px; 12 | overflow-x: auto; 13 | color: black; 14 | } 15 | 16 | a { 17 | color: #007bff; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /client/src/pages/Docs/Docs.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PageHeaderActions from "../../components/PageHeaderActions/PageHeaderActions"; 3 | import "./Docs.scss"; 4 | 5 | 6 | interface Props { } 7 | 8 | const Docs: React.FC = () => { 9 | return ( 10 |
11 |
12 |

Documentation

13 |

14 |

15 |

A simple, no fuss, no mess, no auth playground for learning to play with APIs and call them without thinking of Authentication or permissions.

16 |
17 |
18 |

Purpose

19 |

Understanding RESTful APIs is hard enough, even without including an authentication mechanism. The sole purpose of this repository is to play with RESTful endpoints and learn. We have a few endpoints that you can start playing around with right away! If you are not finding anything you are interested in, create your own endpoints and/or submit a pull request. Take a look at the CONTRIBUTING for more information on how to get involved.

20 |
21 |
22 |

How to use the service

23 |

Choose an endpoint, say "futurama", then choose what information you'd like, say "characters": 24 |

25 |                 fetch("https://api.sampleapis.com/futurama/characters") 
26 | .then(resp => resp.json())
27 | .then(data => console.log(data));
28 |
29 | Want to Search? for all chatacters with the name "Bender"? 30 |
31 |                 fetch(`https://api.sampleapis.com/futurama/characters?name.first=Bender`) 
32 | .then(resp => resp.json())
33 | .then(data => console.log(data));
34 |
35 |

36 | 37 | Want to learn more? Try watching this video that will explain how to use this api and showcase the results 38 | without any front end coding: https://www.youtube.com/watch?v=lCs9EriXnY8 39 | 40 |

41 |

42 |
43 |
44 |

45 | You also have full CRUD, so you can add information or correct existing ones. 46 |

47 | Note: Just know that we reset all datapoints weekly and each time we have a new endpoint added. 48 |

49 |
50 |
51 |

Disclaimers

52 |

53 |

    54 |
  • The data on this site is for educational purposes only and is not owned by SampleAPIs.com
  • 55 |
  • Data will be reset back to its original state on a regular basis. If you are updating or adding data to the endpoints and want to have them persist as part of the collection, please contribute to the repo by submitting a pull request.
  • 56 |
  • By using SampleAPIs.com you agree to the following terms: This service is provided under an "as is" condition. It might change or will be discontinued without prior notice. The maker of this service can't be held liable in any way for any reason.
  • 57 |
58 |

59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |

75 | 76 |
77 |
78 | 79 | ); 80 | }; 81 | 82 | export default Docs; 83 | -------------------------------------------------------------------------------- /client/src/pages/Home/Home.scss: -------------------------------------------------------------------------------- 1 | .section { 2 | margin-top: 50px; 3 | } 4 | pre { 5 | overflow-x: auto; 6 | font-size: 0.9rem; 7 | } 8 | a { 9 | color: #007bff; 10 | } 11 | -------------------------------------------------------------------------------- /client/src/pages/Home/Home.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect, useState } from "react"; 2 | import "./Home.scss"; 3 | 4 | import APICard from "../../components/APICard/APICard"; 5 | import { GlobalContext } from "../../context/GlobalContext"; 6 | import { APIData } from "../../utils/Interfaces"; 7 | import PageHeaderActions from "../../components/PageHeaderActions/PageHeaderActions"; 8 | 9 | interface Props { } 10 | 11 | const Home: React.FC = () => { 12 | const { apiList } = useContext(GlobalContext); 13 | const [featuredAPIs, setFeatureAPIs] = useState([] as APIData[]); 14 | 15 | 16 | useEffect(() => { 17 | const featured = apiList 18 | .filter((api) => api.metaData.featured) 19 | .sort(() => (Math.random() > 0.5 ? 1 : -1)); 20 | setFeatureAPIs(featured); 21 | 22 | 23 | 24 | }, [apiList]); 25 | 26 | return ( 27 |
28 |
29 |

Sample APIs

30 |

31 | A simple, no fuss, no mess, no auth playground for learning{" "} 32 | RESTful or{" "} 33 | GraphQL{" "} 34 | APIs. 35 |

36 | 37 |
38 |
39 |
40 |

Example

41 |
42 |
43 |

44 | Understanding RESTful APIs is hard enough, even without including an 45 | authentication mechanism. The sole purpose of this repository is to 46 | play with RESTful endpoints and learn. We have a few endpoints that 47 | you can start playing around with right away! 48 |

49 |

Here's an example where I've pulled from: 50 | and chosen the "hot" endpoint: https://api.sampleapis.com/coffee/hot
51 | then we ran the following code: 52 |

53 |
54 |             fetch("https://api.sampleapis.com/coffee/hot") 
55 | .then(resp => resp.json())
56 | .then(data => console.log(data[0].title));
57 |
58 |

59 | and randomly selected a coffee and we get the following json back: 60 |

61 |
62 |              "Black Coffee"
63 |           
64 |

65 | Don't believe me? Try it yourself.... 66 |

67 |

or....Want to learn more? Try watching this video that will explain how to use this api and showcase the results 68 | without any front end coding: https://www.youtube.com/watch?v=7MZ6yTzesgg 69 |

70 |
71 |
72 |
73 |
74 |

75 | Featured APIs 76 |

77 |
78 | 79 |
80 | {featuredAPIs && 81 | featuredAPIs.map((api) => ( 82 | 83 | ))} 84 |
85 |
86 |
87 | ); 88 | }; 89 | 90 | export default Home; 91 | -------------------------------------------------------------------------------- /client/src/pages/NotFound/NotFound.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/client/src/pages/NotFound/NotFound.scss -------------------------------------------------------------------------------- /client/src/pages/NotFound/NotFound.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props {} 4 | 5 | const NotFound: React.FC = () => { 6 | return ( 7 |
8 | 9 | {`{ 10 | samplesAPI: { 11 | error: "404 Page not Found" 12 | action: "Navigate back home and try again" 13 | } 14 | }`} 15 | 16 |
17 | ); 18 | }; 19 | 20 | export default NotFound; 21 | -------------------------------------------------------------------------------- /client/src/pages/StyleGuide/StyleGuide.scss: -------------------------------------------------------------------------------- 1 | .StyleGuide { 2 | } 3 | -------------------------------------------------------------------------------- /client/src/pages/StyleGuide/StyleGuide.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props {} 4 | 5 | const StyleGuide: React.FC = () => { 6 | return ( 7 |
8 |
9 |

Home Page

10 |

Home Page

11 |

Home Page

12 |

Home Page

13 |
Home Page
14 |
Home Page
15 |
16 |

This is a story all about how

17 |

This is a story all about how

18 |

This is a story all about how

19 |

This is a story all about how

20 |

This is a story all about how

21 |
22 |

23 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda minus debitis unde 24 | soluta eligendi quasi accusantium facere ratione vel, provident ut fugit? 25 |

26 |

27 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda minus debitis unde 28 | soluta eligendi quasi accusantium facere ratione vel, provident ut fugit? 29 |

30 |

31 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda minus debitis unde 32 | soluta eligendi quasi accusantium facere ratione vel, provident ut fugit? 33 |

34 |
35 |

Sample APIs

36 |

Sample APIs

37 |

Sample APIs

38 |

Sample APIs

39 |

Sample APIs

40 |

Sample APIs

41 |
42 |
43 | ); 44 | }; 45 | 46 | export default StyleGuide; 47 | -------------------------------------------------------------------------------- /client/src/router/routes.tsx: -------------------------------------------------------------------------------- 1 | import { lazy } from "react"; 2 | 3 | const AppRoutes = [ 4 | { 5 | path: "/", 6 | component: lazy(() => import("../pages/Home/Home")), 7 | }, 8 | { 9 | path: "/style-guide", 10 | component: lazy(() => import("../pages/StyleGuide/StyleGuide")), 11 | }, 12 | { 13 | path: "/about", 14 | component: lazy(() => import("../pages/About/About")), 15 | }, 16 | { 17 | path: "/docs", 18 | component: lazy(() => import("../pages/Docs/Docs")), 19 | }, 20 | { 21 | path: "/api-list", 22 | component: lazy(() => import("../pages/APIList/APIList")), 23 | }, 24 | { 25 | path: "/api-list/:id", 26 | component: lazy(() => import("../pages/APIDetails/APIDetails")), 27 | }, 28 | { 29 | path: "/", 30 | exact: false, 31 | component: lazy(() => import("../pages/NotFound/NotFound")), 32 | }, 33 | ]; 34 | 35 | export default AppRoutes; 36 | -------------------------------------------------------------------------------- /client/src/styles/_api-card.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './vars/colors' as *; 3 | 4 | .section-header { 5 | margin-bottom: 1rem; 6 | padding-bottom: 1rem; 7 | border-bottom: 1px solid colors.use-var(text, light); 8 | display: flex; 9 | justify-content: space-between; 10 | align-items: flex-end; 11 | flex-wrap: wrap; 12 | gap: .5rem; 13 | 14 | .actions { 15 | display: flex; 16 | } 17 | } 18 | 19 | .cards-grid { 20 | display: grid; 21 | grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); 22 | grid-template-rows: repeat(auto-fill, minmax(100px, 1fr)); 23 | gap: 2rem; 24 | } 25 | 26 | .api-card { 27 | border: 1px solid colors.use-var(text, light); 28 | position: relative; 29 | 30 | &:before { 31 | content: ""; 32 | position: absolute; 33 | left: 0; 34 | top: 0; 35 | transform: translate(-0.5rem, 0.5rem); 36 | width: 100%; 37 | height: 100%; 38 | z-index: 0; 39 | transition: all 0.25s ease; 40 | } 41 | 42 | @for $i from 1 through length($colors) { 43 | &:nth-child(#{length($colors)}n + #{$i}) { 44 | --card-color: #{nth($colors, $i)}; 45 | color: var(--card-color); 46 | border-color: var(--card-color); 47 | &:before { 48 | background: repeating-linear-gradient( 49 | -45deg, 50 | var(--card-color) 0, 51 | var(--card-color) 4px, 52 | transparent 0, 53 | transparent 8px 54 | ); 55 | } 56 | 57 | &:focus-within, 58 | &:hover { 59 | &:before { 60 | transform: translate(-1rem, 1rem); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | 67 | .api-card__inner { 68 | background: colors.use-var(bg, darkest); 69 | padding: 1rem; 70 | width: 100%; 71 | height: 100%; 72 | display: flex; 73 | flex-direction: column; 74 | position: relative; 75 | z-index: 1; 76 | } 77 | 78 | .api-card__header { 79 | display: flex; 80 | align-items: center; 81 | 82 | .btn { 83 | color: var(--card-color); 84 | margin-left: 0.25rem; 85 | border: none; 86 | 87 | &:focus { 88 | outline: 2px solid var(--card-color); 89 | } 90 | } 91 | 92 | .noleftmargin { 93 | margin-left: 0; 94 | padding-left: 0; 95 | } 96 | } 97 | 98 | .api-card__desc { 99 | p { 100 | margin: 0; 101 | } 102 | } 103 | 104 | .api-card__endpoints { 105 | margin-top: 0.5rem; 106 | position: relative; 107 | 108 | summary { 109 | padding: 0.5rem; 110 | position: relative; 111 | 112 | &:hover, 113 | &:focus { 114 | outline: none; 115 | 116 | &::after { 117 | content: ""; 118 | height: 100%; 119 | width: 100%; 120 | display: block; 121 | position: absolute; 122 | top: 0; 123 | left: 0; 124 | box-shadow: 0 0 0 1px var(--card-color); 125 | } 126 | } 127 | } 128 | 129 | ul { 130 | margin: 0; 131 | background: var(--card-color); 132 | color: colors.use-var(text, dark); 133 | padding: 0.5rem; 134 | position: relative; 135 | 136 | li { 137 | list-style: none; 138 | position: relative; 139 | margin: 0; 140 | padding: 0.5rem; 141 | transition: all 0.25s ease; 142 | 143 | @for $i from 1 through 10 { 144 | &:nth-child(#{$i}) { 145 | transition-delay: #{$i * 0.05}s; 146 | } 147 | } 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /client/src/styles/_api-categories.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './vars/colors' as *; 3 | 4 | .api-categories { 5 | margin: 0; 6 | padding: 0 1rem 0 0; 7 | } 8 | 9 | .api-category { 10 | font-size: 0.85rem; 11 | list-style: none; 12 | display: inline-block; 13 | padding: 0.25rem 0.5rem; 14 | margin-bottom: 0.5rem; 15 | letter-spacing: 1px; 16 | border-radius: 10px; 17 | border-color: var(--cat-color); 18 | background: var(--cat-color); 19 | color: colors.use-var(text, dark); 20 | 21 | &:not(:last-child) { 22 | margin-right: 0.5rem; 23 | } 24 | 25 | @for $i from 1 through length($colors) { 26 | &:nth-child(#{length($colors)}n + #{$i}) { 27 | --cat-color: #{nth($colors, $i)}; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/src/styles/_api-endpoints.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './functions/fonts'; 3 | @use './vars/colors' as *; 4 | 5 | .api-endpoints { 6 | margin: 0; 7 | padding: 0; 8 | display: flex; 9 | flex-wrap: wrap; 10 | gap: .75rem; 11 | } 12 | 13 | .api-endpoint { 14 | list-style: none; 15 | display: block; 16 | 17 | @for $i from 1 through length($colors) { 18 | &:nth-child(#{length($colors)}n + #{$i}) { 19 | .btn { 20 | $color: nth($colors, $i); 21 | --color: #{$color}; 22 | --hover-text: #{darken($color, 50%)}; 23 | border-color: var(--color); 24 | color: var(--color); 25 | 26 | &:focus, 27 | &:hover { 28 | outline: none; 29 | color: var(--hover-text); 30 | background: var(--color); 31 | } 32 | } 33 | } 34 | } 35 | 36 | a { 37 | // color: colors.use-var(text, light); 38 | display: inline-block; 39 | text-transform: capitalize; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /client/src/styles/_api-filter.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './functions/fonts'; 3 | 4 | .api-filter { 5 | position: relative; 6 | display: flex; 7 | justify-content: center; 8 | align-items: center; 9 | 10 | &:before { 11 | content: ""; 12 | position: absolute; 13 | display: block; 14 | border-top: 6px solid colors.use-var(text, light); 15 | border-left: 6px solid transparent; 16 | border-right: 6px solid transparent; 17 | top: 50%; 18 | right: 0; 19 | transform: translate(-50%, -50%); 20 | } 21 | 22 | select { 23 | border: 1px solid transparent; 24 | border-bottom: 1px solid colors.use-var(text, light); 25 | padding: 0.5rem; 26 | background-color: transparent; 27 | color: colors.use-var(text, light); 28 | appearance: none; 29 | font-size: fonts.size(text, 2); 30 | transition: all 0.25s ease; 31 | 32 | &:focus, 33 | &:hover { 34 | border: 1px solid colors.use-var(text, light); 35 | outline: none; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /client/src/styles/_api-search.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './functions/fonts'; 3 | 4 | .api-search { 5 | display: flex; 6 | align-items: center; 7 | justify-content: flex-end; 8 | margin-right: 1rem; 9 | } 10 | 11 | .api-search__inner { 12 | color: colors.use-var(text, light); 13 | font-size: fonts.size(text, 1); 14 | 15 | svg { 16 | font-size: fonts.size(text, 1); 17 | cursor: pointer; 18 | transition: all 0.25s ease-out; 19 | transform: scale(1); 20 | 21 | &:hover { 22 | transform: scale(1.2); 23 | } 24 | } 25 | 26 | input { 27 | font-size: fonts.size(text, 1); 28 | height: 30px; 29 | width: 0; 30 | padding: 1rem; 31 | background: transparent; 32 | color: colors.use-var(text, light); 33 | border: solid 0 transparent; 34 | border-bottom: solid 1px colors.use-var(text, light); 35 | outline: 0; 36 | text-align: right; 37 | transition: all 0.25s ease-out; 38 | transform: scaleX(0); 39 | transform-origin: center right; 40 | 41 | &:focus { 42 | width: 200px; 43 | transform: scaleX(1); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/styles/_base.scss: -------------------------------------------------------------------------------- 1 | @use './functions/screens'; 2 | @use './functions/colors'; 3 | @use './functions/fonts'; 4 | 5 | @use './vars/colors' as *; 6 | 7 | *, 8 | *:before, 9 | *:after { 10 | box-sizing: border-box; 11 | } 12 | 13 | html, 14 | body { 15 | margin: 0; 16 | font-family: fonts.family(text); 17 | font-weight: fonts.weight(base); 18 | color: colors.use-var(text, light); 19 | background: colors.use-var(bg, darkest); 20 | 21 | &.-nav-visible { 22 | height: 100vh; 23 | overflow: hidden; 24 | } 25 | } 26 | 27 | #root{ 28 | display: grid; 29 | grid-template-columns: minmax(25px, 150px) minmax(50%, 90%) minmax(25px, 150px); 30 | grid-template-areas: "left center right"; 31 | margin-bottom: 5rem; 32 | } 33 | 34 | .content { 35 | grid-area: center; 36 | } 37 | 38 | p { 39 | margin: 0; 40 | font-size: fonts.size(text, 2); 41 | max-width: 80ch; 42 | 43 | + P { 44 | margin-top: 1rem; 45 | } 46 | } 47 | 48 | a { 49 | text-decoration: none; 50 | transition: all 0.25s ease; 51 | } 52 | 53 | abbr { 54 | transition: all 0.25s ease; 55 | cursor: help; 56 | position: relative; 57 | 58 | @for $i from 1 through length($colors) { 59 | &:nth-of-type(#{length($colors)}n + #{$i}) { 60 | $color: nth($colors, $i); 61 | --color: #{$color}; 62 | --hover-text: #{darken($color, 50%)}; 63 | border-color: var(--color); 64 | color: var(--color); 65 | 66 | &:focus, 67 | &:hover { 68 | outline: none; 69 | color: var(--hover-text); 70 | background: var(--color); 71 | z-index: 100; 72 | 73 | &::after { 74 | content: attr(title); 75 | background: var(--color); 76 | box-shadow: 0 0 10px black; 77 | position: absolute; 78 | display: block; 79 | bottom: 100%; 80 | left: 0; 81 | padding: 0.25rem 0.5rem; 82 | font-size: fonts.size(text, 3); 83 | white-space: nowrap; 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | .featured-icon { 91 | position: absolute; 92 | top: 1rem; 93 | right: 1rem; 94 | } 95 | -------------------------------------------------------------------------------- /client/src/styles/_buttons.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './functions/fonts'; 3 | 4 | // TODO: Update all padding to use CSS Var 5 | 6 | .btn { 7 | font-size: fonts.size(text, 4); 8 | color: colors.use-var(text, light); 9 | border: 1px solid colors.use-var(text, light); 10 | padding: 0.5rem; 11 | text-decoration: none; 12 | background: transparent; 13 | 14 | span + svg { 15 | display: inline-block; 16 | margin-left: 0.5rem; 17 | } 18 | 19 | &:not(:last-child) { 20 | margin-right: 1rem; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /client/src/styles/_code-display.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | 3 | .top-pane { 4 | background-color: hsl(225, 6%, 25%); 5 | } 6 | 7 | .editor { 8 | display: flex; 9 | } 10 | 11 | .pane { 12 | width: 50vw; 13 | display: flex; 14 | flex-direction: column; 15 | } 16 | 17 | .editor-container { 18 | flex-grow: 1; 19 | flex-basis: 0; 20 | display: flex; 21 | flex-direction: column; 22 | } 23 | 24 | .editor-container.collapsed { 25 | flex-grow: 0; 26 | } 27 | 28 | .editor-container.collapsed .CodeMirror-scroll { 29 | position: absolute; 30 | overflow: hidden !important; 31 | } 32 | 33 | .expand-collapse-btn { 34 | background: none; 35 | border: none; 36 | color: colors.use-var(text, light); 37 | cursor: pointer; 38 | } 39 | 40 | .editor-title { 41 | display: flex; 42 | justify-content: space-between; 43 | background-color: colors.use-var(bg, darkest); 44 | color: colors.use-var(text, light); 45 | padding: 0.5rem; 46 | } 47 | 48 | .CodeMirror { 49 | height: 100% !important; 50 | } 51 | 52 | .code-mirror-wrapper { 53 | flex-grow: 1; 54 | overflow: auto; 55 | } 56 | -------------------------------------------------------------------------------- /client/src/styles/_custom-properties.scss: -------------------------------------------------------------------------------- 1 | @use './vars/colors'; 2 | @use './vars/fonts'; 3 | 4 | :root { 5 | @each $group, $colors in colors.$colors-map { 6 | /*** Color - #{capitalize($group)} ***/ 7 | @each $variant, $color in $colors { 8 | --color-#{$group}-#{$variant}: #{$color}; 9 | } 10 | } 11 | 12 | @each $group, $sizes in fonts.$sizes { 13 | /*** Font Sizes - #{capitalize($group)} ***/ 14 | @each $variant, $size in $sizes { 15 | --font-size-#{$group}-#{$variant}: #{$size}; 16 | } 17 | } 18 | 19 | @each $group, $options in fonts.$details { 20 | /*** Font Details - #{capitalize($group)} ***/ 21 | @each $variant, $option in $options { 22 | --font-#{$group}-#{$variant}: #{$option}; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/src/styles/_header.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './vars/colors' as *; 3 | 4 | @function cosmic_gradient($clrs) { 5 | $colorLength: length($clrs); 6 | $gradient: ""; 7 | 8 | @for $i from 1 through $colorLength { 9 | @if $i < $colorLength { 10 | $gradient: $gradient + nth($clrs, $i) + ", "; 11 | } @else { 12 | $gradient: $gradient + nth($clrs, $i); 13 | } 14 | } 15 | @return $gradient; 16 | } 17 | 18 | .main-header { 19 | display: flex; 20 | justify-content: space-between; 21 | align-items: center; 22 | position: fixed; 23 | z-index: 100; 24 | top: 0; 25 | left: 0; 26 | width: 100vw; 27 | padding: 1rem 2rem; 28 | 29 | &:before { 30 | content: ""; 31 | position: absolute; 32 | top: 0; 33 | left: 0; 34 | width: 100%; 35 | height: 100%; 36 | background: linear-gradient(to right, #{cosmic_gradient($colors)}); 37 | opacity: 0.75; 38 | z-index: -1; 39 | } 40 | } 41 | 42 | .logo { 43 | margin: 0; 44 | font-size: 1rem; 45 | 46 | a { 47 | color: colors.use-var(text, light); 48 | text-decoration: none; 49 | 50 | &:focus, 51 | &:hover { 52 | outline: none; 53 | color: colors.use-var(text, dark); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /client/src/styles/_nav.scss: -------------------------------------------------------------------------------- 1 | @use './functions/fonts'; 2 | @use './functions/colors'; 3 | @use './vars/colors' as *; 4 | 5 | .burger-nav { 6 | background: transparent; 7 | border: none; 8 | color: colors.use-var(text, light); 9 | font-weight: bold; 10 | z-index: 9999; 11 | cursor: pointer; 12 | transition: all 0.25s ease; 13 | display: flex; 14 | padding: 0; 15 | height: 30px; 16 | transform: rotate(-90deg); 17 | 18 | span { 19 | display: block; 20 | transition: all 0.25s ease; 21 | width: 3px; 22 | height: 100%; 23 | background: white; 24 | 25 | &:nth-child(2) { 26 | margin: 0 10px; 27 | } 28 | } 29 | 30 | &:focus { 31 | outline: none; 32 | span { 33 | background: colors.use-var(text, dark); 34 | .-nav-visible & { 35 | background: colors.use-var(primary); 36 | } 37 | } 38 | } 39 | 40 | .-nav-visible & { 41 | span { 42 | opacity: 0; 43 | &:first-of-type { 44 | transform: rotate(-45deg) translate(-50%, 10%); 45 | transform-origin: top right; 46 | opacity: 1; 47 | } 48 | &:last-of-type { 49 | transform: rotate(45deg) translate(50%, 20%); 50 | transform-origin: top right; 51 | opacity: 1; 52 | } 53 | } 54 | } 55 | } 56 | 57 | .full-screen-nav { 58 | position: fixed; 59 | z-index: 9998; 60 | width: 100%; 61 | height: 100vh; 62 | background: colors.use-var(bg, darkest); 63 | visibility: hidden; 64 | transition: all 0.25s ease; 65 | opacity: 0; 66 | top: 0; 67 | left: 0; 68 | display: flex; 69 | justify-content: center; 70 | align-items: center; 71 | 72 | ul { 73 | margin: 0; 74 | padding: 0; 75 | text-align: center; 76 | vertical-align: middle; 77 | width: 100%; 78 | 79 | li { 80 | list-style: none; 81 | 82 | @for $i from 1 through length($colors) { 83 | &:nth-child(#{length($colors)}n + #{$i}) { 84 | a { 85 | $color: nth($colors, $i); 86 | --color: #{$color}; 87 | --hover-text: #{darken($color, 50%)}; 88 | border-color: var(--color); 89 | color: var(--color); 90 | 91 | &:focus, 92 | &:hover { 93 | outline: none; 94 | color: var(--hover-text); 95 | background: var(--color); 96 | } 97 | } 98 | } 99 | } 100 | } 101 | 102 | a { 103 | display: block; 104 | font-size: fonts.size(text, 1); 105 | color: colors.use-var(text, light); 106 | text-decoration: none; 107 | padding: 6rem; 108 | transition: all 0.25s ease; 109 | } 110 | } 111 | 112 | .-nav-visible & { 113 | opacity: 1 !important; 114 | visibility: visible !important; 115 | 116 | a { 117 | opacity: 1 !important; 118 | padding: 2rem; 119 | } 120 | } 121 | } 122 | 123 | .fadeIn { 124 | opacity: 1 !important; 125 | visibility: visible !important; 126 | } 127 | 128 | .fadeUp { 129 | opacity: 1 !important; 130 | margin-top: 0 !important; 131 | } 132 | -------------------------------------------------------------------------------- /client/src/styles/_not-found.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | 3 | .-not-found { 4 | display: block; 5 | background: linear-gradient(180deg, rgba(2, 214, 233, 1) 0%, rgba(249, 248, 113, 1) 100%); 6 | width: 100vw; 7 | height: 100vh; 8 | font-size: 1.5rem; 9 | position: fixed; 10 | top: 0; 11 | left: 0; 12 | display: flex; 13 | justify-content: center; 14 | align-items: center; 15 | 16 | code { 17 | font-size: 3rem; 18 | white-space: pre-wrap; 19 | padding: 0; 20 | letter-spacing: 0.1rem; 21 | line-height: 2em; 22 | background: none; 23 | box-shadow: none; 24 | font-weight: bold; 25 | color: colors.use-var(text, dark); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /client/src/styles/_page.scss: -------------------------------------------------------------------------------- 1 | @use './functions/colors'; 2 | @use './functions/fonts'; 3 | @use './vars/colors' as *; 4 | 5 | .page { 6 | position: relative; 7 | } 8 | 9 | .page-header { 10 | padding: 20rem 0 2rem; 11 | max-width: 100ch; 12 | } 13 | 14 | .page-header__title { 15 | font-family: fonts.family(display); 16 | font-size: fonts.size(display, 1); 17 | } 18 | 19 | .page-header__desc { 20 | font-size: fonts.size(heading, 1); 21 | } 22 | 23 | .page-header-actions { 24 | padding: 1rem 0 0; 25 | 26 | @for $i from 1 through length($colors) { 27 | .btn:nth-child(#{length($colors)}n + #{$i}) { 28 | $color: nth($colors, $i); 29 | --color: #{$color}; 30 | --hover-text: #{darken($color, 50%)}; 31 | border-color: var(--color); 32 | color: var(--color); 33 | 34 | &:focus, 35 | &:hover { 36 | outline: none; 37 | color: var(--hover-text); 38 | filter: hue-rotate(15deg); 39 | background: var(--color); 40 | } 41 | } 42 | } 43 | } 44 | 45 | .section { 46 | p { 47 | line-height: fonts.height(comfortable); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/src/styles/_typography.scss: -------------------------------------------------------------------------------- 1 | @use './functions/fonts'; 2 | @use './functions/colors'; 3 | 4 | h1, 5 | .h1, 6 | h2, 7 | .h2, 8 | h3, 9 | .h3, 10 | h4, 11 | .h4, 12 | h5, 13 | .h5, 14 | h6, 15 | .h6 { 16 | font-family: fonts.family(text); 17 | margin: 0; 18 | line-height: 1.25em; 19 | } 20 | 21 | h1, 22 | .h1 { 23 | font-size: fonts.size(heading, 1); 24 | } 25 | 26 | h2, 27 | .h2 { 28 | font-size: fonts.size(heading, 2); 29 | } 30 | 31 | h3, 32 | .h3 { 33 | font-size: fonts.size(heading, 3); 34 | } 35 | 36 | h4, 37 | .h4 { 38 | font-size: fonts.size(heading, 4); 39 | } 40 | 41 | h5, 42 | .h5 { 43 | font-size: fonts.size(heading, 5); 44 | } 45 | 46 | h6, 47 | .h6 { 48 | font-size: fonts.size(heading, 6); 49 | } 50 | 51 | .display-1, 52 | .display-2, 53 | .display-3, 54 | .display-4, 55 | .display-5, 56 | .display-6 { 57 | font-family: fonts.family(display); 58 | font-weight: fonts.weight(thick); 59 | margin: 0; 60 | line-height: 1.25em; 61 | } 62 | 63 | .display-1 { 64 | font-size: fonts.size(display, 1); 65 | } 66 | 67 | .display-2 { 68 | font-size: fonts.size(display, 2); 69 | } 70 | 71 | .display-3 { 72 | font-size: fonts.size(display, 3); 73 | } 74 | 75 | .display-4 { 76 | font-size: fonts.size(display, 4); 77 | } 78 | 79 | .display-5 { 80 | font-size: fonts.size(display, 5); 81 | } 82 | 83 | .display-6 { 84 | font-size: fonts.size(display, 6); 85 | } 86 | 87 | .text-1 { 88 | font-size: fonts.size(text, 1); 89 | } 90 | 91 | .text-2 { 92 | font-size: fonts.size(text, 2); 93 | } 94 | 95 | .text-3 { 96 | font-size: fonts.size(text, 3); 97 | } 98 | 99 | .text-4 { 100 | font-size: fonts.size(text, 4); 101 | } 102 | 103 | .text-5 { 104 | font-size: fonts.size(text, 5); 105 | } 106 | -------------------------------------------------------------------------------- /client/src/styles/functions/_colors.scss: -------------------------------------------------------------------------------- 1 | @use '../vars/colors'; 2 | 3 | // ---------------------------------------------------- 4 | // Creates CSS Custom Property syntax for colors 5 | // @param {string} $group 6 | // @param {string} $variant 7 | // 8 | // 1. Validates the $group param. 9 | // 2. Validates the $variant param 10 | // 3. Returns proper CSS Custom Property syntax 11 | // 4. Throws error for invalid $variant param 12 | // 5. Throws error for invalid $group param 13 | // 14 | @function use-var($group, $variant: base) { 15 | $map: colors.$colors-map; 16 | 17 | // [1] 18 | @if map-has-key($map, $group) { 19 | // [2] 20 | @if map-has-key(map-get($map, $group), $variant) { 21 | // [3] 22 | @return var(--color-#{$group}-#{$variant}); 23 | } @else { 24 | // [4] 25 | @error "`#{$variant}` is not a valid key in `$colors-map.#{$group}`."; 26 | } 27 | } @else { 28 | // [5] 29 | @error "`#{$group}` is not a valid key in `$colors-map`."; 30 | } 31 | } 32 | 33 | // ---------------------------------------------------- 34 | // Creates HEX syntax for colors 35 | // @param {string} $group 36 | // @param {string} $variant 37 | // 38 | // 1. Validates the $group param. 39 | // 2. Validates the $variant param 40 | // 3. Returns proper CSS Custom Property syntax 41 | // 4. Throws error for invalid $variant param 42 | // 5. Throws error for invalid $group param 43 | // 44 | @function use-hex($group, $variant: base) { 45 | $map: colors.$colors-map; 46 | 47 | // [1] 48 | @if map-has-key($map, $group) { 49 | // [2] 50 | @if map-has-key(map-get($map, $group), $variant) { 51 | // [3] 52 | @return map-get(map-get($map, $group), $variant); 53 | } @else { 54 | // [4] 55 | @error "`#{$variant}` is not a valid key in `#{$group}` color map."; 56 | } 57 | } @else { 58 | // [5] 59 | @error "`#{$group}` is not a valid key in `$colors-map`."; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /client/src/styles/functions/_fonts.scss: -------------------------------------------------------------------------------- 1 | @use '../vars/fonts'; 2 | 3 | @function size($group, $size) { 4 | @return var(--font-size-#{$group}-#{$size}); 5 | } 6 | 7 | @function family($group) { 8 | $map: map-get(fonts.$details, family); 9 | 10 | @if map-has-key($map, $group) { 11 | @return var(--font-family-#{$group}); 12 | } @else { 13 | @error "`#{$group}` is not a valid key in `$details.family`."; 14 | } 15 | } 16 | 17 | @function weight($weight) { 18 | $map: map-get(fonts.$details, weight); 19 | 20 | @if map-has-key($map, $weight) { 21 | @return var(--font-weight-#{$weight}); 22 | } @else { 23 | @error "`#{$weight}` is not a valid key in `$details.weight`."; 24 | } 25 | } 26 | 27 | @function height($height) { 28 | $map: map-get(fonts.$details, height); 29 | 30 | @if map-has-key($map, $height) { 31 | @return var(--font-height-#{$height}); 32 | } @else { 33 | @error "`#{$height}` is not a valid key in `$details.height`."; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /client/src/styles/functions/_index.scss: -------------------------------------------------------------------------------- 1 | @use 'colors'; 2 | @use 'screens'; 3 | -------------------------------------------------------------------------------- /client/src/styles/functions/_screens.scss: -------------------------------------------------------------------------------- 1 | @use '../vars/screens'; 2 | 3 | // ----------------------------------------------------------= 4 | // Creates media min query based on predefined breakpoint sizes 5 | // @param {string} $group 6 | // @param {string} $variant 7 | // 8 | // 1. Validates the $size param. 9 | // 2. Returns proper Media Query syntax 10 | // 3. Throws error for invalid $size param 11 | // 12 | @mixin min($size) { 13 | $map: screens.$breakpoints; 14 | 15 | // [1] 16 | @if map-has-key($map, $size) { 17 | // [2] 18 | @media (min-width: map-get(screens.$breakpoints, $size)) { 19 | @content; 20 | } 21 | } @else { 22 | // [3] 23 | @error "`#{$size}` is not a valid key in `$breakpoints`."; 24 | } 25 | } 26 | 27 | // ----------------------------------------------------------= 28 | // Creates media max query based on predefined breakpoint sizes 29 | // @param {string} $group 30 | // @param {string} $variant 31 | // 32 | // 1. Validates the $size param. 33 | // 2. Returns proper Media Query syntax 34 | // 3. Throws error for invalid $size param 35 | // 36 | @mixin max($size) { 37 | $map: screens.$breakpoints; 38 | 39 | // [1] 40 | @if map-has-key($map, $size) { 41 | // [2] 42 | @media (max-width: map-get(screens.$breakpoints, $size)) { 43 | @content; 44 | } 45 | } @else { 46 | // [3] 47 | @error "`#{$size}` is not a valid key in `$breakpoints`."; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/src/styles/mixins/_colors.scss: -------------------------------------------------------------------------------- 1 | @use '../vars/colors' as *; 2 | 3 | // This might be making things to abstract and complicated 4 | // Might delete later 5 | @mixin color-cycle($element) { 6 | @for $i from 1 through length($colors) { 7 | .#{$element}:nth-child(#{length($colors)}n + #{$i}) { 8 | $color: nth($colors, $i); 9 | --color: #{$color}; 10 | --hover-text: #{darken($color, 50%)}; 11 | @content; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /client/src/styles/styles.scss: -------------------------------------------------------------------------------- 1 | @use 'custom-properties'; 2 | @use 'base'; 3 | @use 'typography'; 4 | @use 'buttons'; 5 | @use 'header'; 6 | @use 'nav'; 7 | @use 'page'; 8 | @use 'api-card'; 9 | @use 'api-categories'; 10 | @use 'api-search'; 11 | @use 'api-filter'; 12 | @use 'api-endpoints'; 13 | @use 'code-display'; 14 | @use 'not-found'; 15 | -------------------------------------------------------------------------------- /client/src/styles/vars/_colors.scss: -------------------------------------------------------------------------------- 1 | // Greys 2 | $white: #ffffff; 3 | $grey-1: #fafafa; 4 | $grey-2: #efefef; 5 | $grey-3: #eeeeee; 6 | $grey-4: #e0e0e0; 7 | $grey-5: #bdbdbd; 8 | $grey-6: #9e9e9e; 9 | $grey-7: #757575; 10 | $grey-8: #505050; 11 | $grey-9: #363636; 12 | $black: #181818; 13 | 14 | $bright-turquoise: #00d6e9; 15 | $piston-blue: #15e3d9; 16 | $turquoise-blue: #56edbf; 17 | $mint-green: #8cf5a2; 18 | $mineral: #c2f985; 19 | $festival: #f9f871; 20 | 21 | // This is used for color effects in the site. 22 | $colors: ($bright-turquoise, $piston-blue, $turquoise-blue, $mint-green, $mineral, $festival); 23 | 24 | $colors-map: ( 25 | primary: ( 26 | base: $bright-turquoise, 27 | light: lighten($bright-turquoise, 5%), 28 | dark: darken($bright-turquoise, 5%), 29 | ), 30 | buttons: ( 31 | base: $bright-turquoise, 32 | light: lighten($bright-turquoise, 5%), 33 | dark: darken($bright-turquoise, 5%), 34 | ), 35 | secondary: ( 36 | base: $festival, 37 | light: lighten($festival, 5%), 38 | dark: darken($festival, 5%), 39 | ), 40 | text: ( 41 | light: $grey-1, 42 | base: $grey-5, 43 | dark: $grey-9, 44 | ), 45 | bg: ( 46 | lightest: $white, 47 | light: $grey-2, 48 | base: $grey-5, 49 | dark: $grey-8, 50 | darkest: $black, 51 | ), 52 | ); 53 | -------------------------------------------------------------------------------- /client/src/styles/vars/_fonts.scss: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght@200;400;600&family=Roboto:wght@200;400;600&display=swap"); 2 | 3 | $font-size-base: 1rem !default; 4 | 5 | $font-families: ( 6 | display: "Montserrat Alternates", 7 | text: "Roboto", 8 | ); 9 | 10 | $font-weights: ( 11 | thin: 200, 12 | base: 400, 13 | thick: 600, 14 | ); 15 | 16 | $line-heights: ( 17 | compact: 1em, 18 | normal: 1.25em, 19 | comfortable: 1.75em, 20 | ); 21 | 22 | $details: ( 23 | family: $font-families, 24 | weight: $font-weights, 25 | height: $line-heights, 26 | ); 27 | 28 | $text-sizes: ( 29 | 1: $font-size-base * 1.55, 30 | 2: $font-size-base * 1.25, 31 | 3: $font-size-base, 32 | 4: $font-size-base * 0.875, 33 | 5: $font-size-base * 0.675, 34 | ); 35 | 36 | $heading-sizes: ( 37 | 1: $font-size-base * 2.5, 38 | 2: $font-size-base * 2, 39 | 3: $font-size-base * 1.75, 40 | 4: $font-size-base * 1.5, 41 | 5: $font-size-base * 1.25, 42 | 6: $font-size-base, 43 | ); 44 | 45 | $display-sizes: ( 46 | 1: 5rem, 47 | 2: 4.5rem, 48 | 3: 4rem, 49 | 4: 3.5rem, 50 | 5: 3rem, 51 | 6: 2.5rem, 52 | ); 53 | 54 | $sizes: ( 55 | text: $text-sizes, 56 | heading: $heading-sizes, 57 | display: $display-sizes, 58 | ); 59 | -------------------------------------------------------------------------------- /client/src/styles/vars/_index.scss: -------------------------------------------------------------------------------- 1 | @use 'colors'; 2 | @use 'containers'; 3 | -------------------------------------------------------------------------------- /client/src/styles/vars/_screens.scss: -------------------------------------------------------------------------------- 1 | $container-max-widths: ( 2 | xs: 90%, 3 | sm: 400px, 4 | md: 688px, 5 | lg: 944px, 6 | xl: 1194px, 7 | xxl: 1468px, 8 | ); 9 | 10 | $breakpoints: ( 11 | xs: 0, 12 | sm: 480px, 13 | md: 768px, 14 | lg: 1024px, 15 | xl: 1274px, 16 | xxl: 1548px, 17 | ); 18 | -------------------------------------------------------------------------------- /client/src/utils/Config.ts: -------------------------------------------------------------------------------- 1 | export const URLS = { 2 | API_LINK: process.env.NODE_ENV === "production" ? "https://api.sampleapis.com" : "http://localhost:5555" 3 | }; 4 | -------------------------------------------------------------------------------- /client/src/utils/Enums.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | export enum AppStateEnum { 3 | initial = "INITIAL", 4 | loading = "LOADING", 5 | ready = "READY", 6 | error = "ERROR", 7 | } 8 | -------------------------------------------------------------------------------- /client/src/utils/Helpers.ts: -------------------------------------------------------------------------------- 1 | export const upperCase = (str: string): string => { 2 | return str.slice(0, 1).toUpperCase() + str.slice(1); 3 | }; 4 | -------------------------------------------------------------------------------- /client/src/utils/Interfaces.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from "react"; 2 | import { AppStateEnum } from "./Enums"; 3 | 4 | export interface iGlobal { 5 | navVisible: boolean; 6 | setNavVisible: Dispatch; 7 | apiList: APIData[]; 8 | setAPIList: Dispatch; 9 | appState: AppStateEnum; 10 | setAppState: Dispatch; 11 | isLoggedIn: boolean; 12 | setIsLoggedIn: Dispatch; 13 | apiCategories: string[]; 14 | setApiCategories: Dispatch; 15 | } 16 | 17 | export interface FetchState { 18 | status: number; 19 | data: T | null; 20 | error?: string; 21 | } 22 | 23 | export interface APIListResponse { 24 | APIListData: APIData[]; 25 | } 26 | 27 | export interface APIData { 28 | name: string; 29 | link: string; 30 | metaData: MetaData; 31 | endpoints: string[]; 32 | } 33 | 34 | export interface MetaData { 35 | title: string; 36 | longDesc: string; 37 | desc: string; 38 | featured: boolean; 39 | categories: string[]; 40 | examples?: Example[]; 41 | } 42 | 43 | export interface Example { 44 | hash: string; 45 | title: string; 46 | endpoint: string; 47 | user?: string; 48 | defaultTab?: string; 49 | } 50 | -------------------------------------------------------------------------------- /client/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /client/templates/component/TemplateName.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props {} 4 | 5 | const TemplateName: React.FC = () => { 6 | return ( 7 |
8 | TemplateName Component 9 |
10 | ); 11 | }; 12 | 13 | export default TemplateName; 14 | -------------------------------------------------------------------------------- /client/templates/hooks/TemplateName.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | 3 | type ReturnState = { 4 | state: string; 5 | }; 6 | 7 | function useTemplateName(): ReturnState { 8 | const [state, setState] = useState(""); 9 | 10 | useEffect(() => { 11 | setState(""); 12 | }, [state]); 13 | 14 | return { state }; 15 | } 16 | 17 | export default useTemplateName; 18 | -------------------------------------------------------------------------------- /client/templates/layout/TemplateName.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props {} 4 | 5 | const TemplateName: React.FC = () => { 6 | return ( 7 |
8 | TemplateName Layout 9 |
10 | ); 11 | }; 12 | 13 | export default TemplateName; 14 | -------------------------------------------------------------------------------- /client/templates/page/TemplateName.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props {} 4 | 5 | const TemplateName: React.FC = () => { 6 | return ( 7 |
8 | TemplateName Page 9 |
10 | ); 11 | }; 12 | 13 | export default TemplateName; 14 | -------------------------------------------------------------------------------- /client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 6 | "allowJs": false, 7 | "skipLibCheck": true, 8 | "esModuleInterop": false, 9 | "allowSyntheticDefaultImports": true, 10 | "strict": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "module": "ESNext", 13 | "moduleResolution": "Node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "noEmit": true, 17 | "jsx": "react-jsx" 18 | }, 19 | "include": ["src"], 20 | "references": [{ "path": "./tsconfig.node.json" }] 21 | } 22 | -------------------------------------------------------------------------------- /client/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /client/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react-swc' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sampleapis", 3 | "version": "2.8.0", 4 | "author": "Jeremy 'Jermbo' Lawson", 5 | "description": "", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/jermbo/SampleAPIs.git" 10 | }, 11 | "keywords": [ 12 | "RESTful", 13 | "Learning" 14 | ], 15 | "scripts": { 16 | "server": "npm run server --prefix server", 17 | "client": "npm run start --prefix client", 18 | "dev": "concurrently \"npm run server\" \"npm run client\"" 19 | }, 20 | "homepage": "https://github.com/jermbo/SampleAPIs#readme", 21 | "devDependencies": { 22 | "concurrently": "^5.3.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /server/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#2f7c47", 4 | "activityBar.activeBorder": "#422c74", 5 | "activityBar.background": "#2f7c47", 6 | "activityBar.foreground": "#e7e7e7", 7 | "activityBar.inactiveForeground": "#e7e7e799", 8 | "activityBarBadge.background": "#422c74", 9 | "activityBarBadge.foreground": "#e7e7e7", 10 | "statusBar.background": "#215732", 11 | "statusBar.foreground": "#e7e7e7", 12 | "statusBarItem.hoverBackground": "#2f7c47", 13 | "titleBar.activeBackground": "#215732", 14 | "titleBar.activeForeground": "#e7e7e7", 15 | "titleBar.inactiveBackground": "#21573299", 16 | "titleBar.inactiveForeground": "#e7e7e799", 17 | "sash.hoverBorder": "#2f7c47", 18 | "statusBarItem.remoteBackground": "#215732", 19 | "statusBarItem.remoteForeground": "#e7e7e7", 20 | "commandCenter.border": "#e7e7e799" 21 | }, 22 | "peacock.color": "#215732" 23 | } -------------------------------------------------------------------------------- /server/GeneratedAPIList.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | name: "avatar", 4 | link: "avatar", 5 | metaData: { 6 | title: "Avatar", 7 | longDesc: 8 | "If you are an Avatar fan, then this api is for you. Here you can find everything from Episodes to Characters to Trivia Questions and more.", 9 | desc: "An API with characters, episode listings, and trivia questions.", 10 | featured: false, 11 | categories: ["cartoon", "tv", "entertainment", "quiz"], 12 | }, 13 | endpoints: ["info", "characters", "episodes", "questions"], 14 | }, 15 | { 16 | name: "baseball", 17 | link: "baseball", 18 | metaData: { 19 | title: "Baseball", 20 | longDesc: 21 | "Baseball fans? Computer nerds? Now, in one place, you have baseball data and an api to access it. Have fun!", 22 | desc: "An API with records and trivia questions.", 23 | featured: false, 24 | categories: ["sports", "stats"], 25 | }, 26 | endpoints: [ 27 | "hitsSingleSeason", 28 | "hitsCareer", 29 | "eraSingleSeason", 30 | "eraCareer", 31 | "stolenBasesSingleSeason", 32 | "stolenBasesCareer", 33 | "battingAvgsSingleSeason", 34 | "battingAvgsCareer", 35 | "rbiSingleSeason", 36 | "rbiCareer", 37 | ], 38 | }, 39 | { 40 | name: "beers", 41 | link: "beers", 42 | metaData: { 43 | title: "Beers", 44 | longDesc: "Beers.", 45 | desc: "Beers", 46 | featured: true, 47 | categories: ["food & beverage", "list"], 48 | }, 49 | endpoints: ["ale", "stouts", "red-ale"], 50 | }, 51 | { 52 | name: "cartoons", 53 | link: "cartoons", 54 | metaData: { 55 | title: "Cartoons", 56 | longDesc: 57 | "If cartoons is what you like then boy do we have a full list of all the cartoons from the past and present and all their details including a amazingly sourced image to showcase", 58 | desc: "A list of Cartoons from your past.", 59 | featured: false, 60 | categories: ["tv", "entertainment", "list"], 61 | }, 62 | endpoints: ["cartoons2D", "cartoons3D"], 63 | }, 64 | { 65 | name: "codingresources", 66 | link: "codingresources", 67 | metaData: { 68 | title: "Coding Resources", 69 | longDesc: 70 | "Women Who Code.com is an amazing community and organization. They have an amazing resource in https://www.womenwhocode.com/resources. Here you'll find their 170 resources in an API for easy search, list and share. Please give a link BACK to WomenWhoCode.com if you use this information.", 71 | desc: "API for all coding resources from womenwhocode.com/resources", 72 | featured: true, 73 | categories: ["list", "education", "coding"], 74 | }, 75 | endpoints: ["codingResources"], 76 | }, 77 | { 78 | name: "coffee", 79 | link: "coffee", 80 | metaData: { 81 | title: "Coffee", 82 | longDesc: "Basic list of descriptions and ingredients used for the most popular coffee drinks", 83 | desc: "API for popular coffee drinks", 84 | featured: true, 85 | categories: ["food & beverage", "list"], 86 | }, 87 | endpoints: ["hot", "iced"], 88 | }, 89 | { 90 | name: "countries", 91 | link: "countries", 92 | metaData: { 93 | title: "Countries", 94 | longDesc: 95 | "Who doesn't need to get the dreaded long list of countries, codes, capitals, etc. every other week? You can get them all right here.", 96 | desc: "An API with information about countries.", 97 | featured: false, 98 | categories: ["list"], 99 | }, 100 | endpoints: ["countries"], 101 | }, 102 | { 103 | name: "csscolornames", 104 | link: "csscolornames", 105 | metaData: { 106 | title: "CSS Color Names", 107 | longDesc: 108 | "Thought it would be cool to include different CSS Colors Names. I was inspired when I found this site, https://xkcd.com/color/rgb/.", 109 | desc: "A list of CSS Color Names", 110 | featured: false, 111 | categories: ["list"], 112 | }, 113 | endpoints: ["colors"], 114 | }, 115 | { 116 | name: "fakebank", 117 | link: "fakebank", 118 | metaData: { 119 | title: "FakeBank", 120 | longDesc: 121 | "Building an app that needs some bake transactions? Well, look no further. Here are what Fry's bank statements might look like from the future.", 122 | desc: "Just a random set of fake bank data.", 123 | featured: false, 124 | categories: ["bank"], 125 | }, 126 | endpoints: ["accounts"], 127 | }, 128 | { 129 | name: "football", 130 | link: "football", 131 | metaData: { 132 | title: "Football", 133 | longDesc: 134 | "Football fans? Computer nerds? Now, in one place, you have football data and an api to access it. Have fun!", 135 | desc: "An API with records and trivia questions.", 136 | featured: false, 137 | categories: ["sports", "stats"], 138 | }, 139 | endpoints: ["passingyards-singleseason", "passingyards-career", "passingtd-singleseason", "passingtd-career"], 140 | }, 141 | { 142 | name: "futurama", 143 | link: "futurama", 144 | metaData: { 145 | title: "Futurama", 146 | longDesc: 147 | "If you are a Futurama fan, then this api is for you. Here you can find everything from Episodes to Characters to Trivia Questions, and even some of the Products featured on the show.", 148 | desc: "An API with characters, episode listing, species, planets, and trivia questions.", 149 | featured: true, 150 | categories: ["cartoon", "tv", "entertainment", "quiz", "inventory"], 151 | examples: [ 152 | { hash: "ZEeybwX", title: "Inventory Vanilla", endpoint: "inventory" }, 153 | { hash: "vyGrmG", title: "Vue - Futurama Quiz", endpoint: "questions" }, 154 | { hash: "LYVwbZG", title: "jQuery - Futurama Quiz", endpoint: "questions" }, 155 | ], 156 | }, 157 | endpoints: ["info", "characters", "cast", "episodes", "questions", "inventory"], 158 | }, 159 | { 160 | name: "health", 161 | link: "health", 162 | metaData: { 163 | title: "Health", 164 | longDesc: 165 | "Sometimes health data is hard to come by. This endpoints make it easy for you to test your apps with examples of health data such as medical professions.", 166 | desc: "An API with health and medical information", 167 | featured: false, 168 | categories: ["list"], 169 | }, 170 | endpoints: ["professions"], 171 | }, 172 | { 173 | name: "monstersanctuary", 174 | link: "monstersanctuary", 175 | metaData: { 176 | title: "monster-sanctuary", 177 | longDesc: "monster-sanctuary", 178 | desc: "monster-sanctuary", 179 | featured: false, 180 | categories: ["games"], 181 | }, 182 | endpoints: ["monsters"], 183 | }, 184 | { 185 | name: "movies", 186 | link: "movies", 187 | metaData: { 188 | title: "Movies", 189 | longDesc: "Movies", 190 | desc: "Movies", 191 | featured: false, 192 | categories: ["list", "entertainment"], 193 | }, 194 | endpoints: [ 195 | "action-adventure", 196 | "animation", 197 | "classic", 198 | "comedy", 199 | "drama", 200 | "horror", 201 | "family", 202 | "mystery", 203 | "scifi-fantasy", 204 | "western", 205 | ], 206 | }, 207 | { 208 | name: "playstation", 209 | link: "playstation", 210 | metaData: { 211 | title: "PlayStation Games", 212 | longDesc: "Figured it would be a cool db to have various video games on the PlayStation 4.", 213 | desc: "Figured it would be fun to have a PlayStation game list on here.", 214 | featured: false, 215 | categories: ["games", "list", "entertainment"], 216 | }, 217 | endpoints: ["games"], 218 | }, 219 | { 220 | name: "presidents", 221 | link: "presidents", 222 | metaData: { 223 | title: "Presidents", 224 | longDesc: 225 | "Millions of peaches! No...not those Presidents. You're practicing API calls, why not learn a little bit about United States history in the process? Here we have a collection of all the US Presidents. Updated every 4-8 years.", 226 | desc: "Millions of peaches! No...not those Presidents...", 227 | featured: false, 228 | categories: ["list"], 229 | }, 230 | endpoints: ["presidents"], 231 | }, 232 | { 233 | name: "recipes", 234 | link: "recipes", 235 | metaData: { 236 | title: "Recipes", 237 | longDesc: "Because everyone is making a recipe app to learn to code. So, here is some data.", 238 | desc: "A recipe database", 239 | featured: false, 240 | categories: ["food & beverage", "list"], 241 | }, 242 | endpoints: ["recipes"], 243 | }, 244 | { 245 | name: "rickandmorty", 246 | link: "rickandmorty", 247 | metaData: { 248 | title: "Rick And Morty", 249 | longDesc: 250 | "Get all the Rick-iest Episodes, Locations and Characters from a copy of the https://rickandmortyapi.com data. That's the way Rick would have done it!", 251 | desc: "API for all current Rick & Morty episodes, locations and characters", 252 | featured: false, 253 | categories: ["cartoon", "tv", "entertainment"], 254 | }, 255 | endpoints: ["characters", "episodes", "locations"], 256 | }, 257 | { 258 | name: "simpsons", 259 | link: "simpsons", 260 | metaData: { 261 | title: "Simpsons", 262 | longDesc: "Because who doesn't need easily accessible data about the simpsons?", 263 | desc: "Because who doesn't need easily accessible data about the simpsons?", 264 | featured: false, 265 | categories: ["cartoon", "tv", "entertainment", "products"], 266 | }, 267 | endpoints: ["characters", "products", "episodes"], 268 | }, 269 | { 270 | name: "switch", 271 | link: "switch", 272 | metaData: { 273 | title: "Switch Games", 274 | longDesc: "Figured it would be a cool db to have various video games on the Switch.", 275 | desc: "Figured it would be fun to have a Switch game list on here.", 276 | featured: true, 277 | categories: ["games", "list", "entertainment"], 278 | }, 279 | endpoints: ["games"], 280 | }, 281 | { 282 | name: "thestates", 283 | link: "thestates", 284 | metaData: { 285 | title: "The United States", 286 | longDesc: 287 | "Info about the all the 50 states in the United States. The endpoint includes the name, abbreviation, capital, largest city, date admitted to union, population, and state flag.", 288 | desc: "Info about the all the 50 states in the United States.", 289 | featured: false, 290 | categories: ["list"], 291 | }, 292 | endpoints: ["the-states"], 293 | }, 294 | { 295 | name: "typer", 296 | link: "typer", 297 | metaData: { 298 | title: "Typer", 299 | longDesc: "A place to hold lessons for Typer", 300 | desc: "A place to hold lessons for Typer", 301 | featured: false, 302 | categories: ["education"], 303 | }, 304 | endpoints: ["welcomeQuestions", "webLessons", "typingLessons"], 305 | }, 306 | { 307 | name: "wines", 308 | link: "wines", 309 | metaData: { 310 | title: "Wines", 311 | longDesc: "Wines.", 312 | desc: "Wines", 313 | featured: true, 314 | categories: ["food & beverage", "list"], 315 | }, 316 | endpoints: ["reds", "whites", "sparkling", "rose", "dessert", "port"], 317 | }, 318 | { 319 | name: "xbox", 320 | link: "xbox", 321 | metaData: { 322 | title: "XBox Games", 323 | longDesc: "Figured it would be a cool db to have various video games on the XBox.", 324 | desc: "Figured it would be fun to have a Xbox game list on here.", 325 | featured: false, 326 | categories: ["games", "list", "entertainment"], 327 | }, 328 | endpoints: ["games"], 329 | }, 330 | { 331 | name: "jokes", 332 | link: "jokes", 333 | metaData: { 334 | title: "Jokes", 335 | longDesc: "Sometimes you need a list of great Jokes", 336 | desc: "An API with jokes. Mostly bad, but some good ones ;-P", 337 | featured: false, 338 | categories: ["funny"], 339 | }, 340 | endpoints: ["goodJokes"], 341 | }, 342 | { 343 | name: "bitcoin", 344 | link: "bitcoin", 345 | metaData: { 346 | title: "Bitcoin (historical data)", 347 | longDesc: "You've wanted it and now we got it. Going back from January 2022 to August 2010", 348 | desc: "Bitcoin Historical Data from August 2010 to January 2022", 349 | featured: false, 350 | categories: ["crypto","prices"], 351 | }, 352 | endpoints: ["historical_prices"], 353 | }, 354 | ]; 355 | -------------------------------------------------------------------------------- /server/api/cartoons.json: -------------------------------------------------------------------------------- 1 | { 2 | "metaData": [ 3 | { 4 | "title": "Cartoons", 5 | "longDesc": "If cartoons is what you like then boy do we have a full list of all the cartoons from the past and present and all their details including a amazingly sourced image to showcase", 6 | "desc": "A list of Cartoons from your past.", 7 | "featured": false, 8 | "categories": ["tv", "entertainment", "list"] 9 | } 10 | ], 11 | "cartoons2D": [ 12 | { 13 | "title": "Spongebob Squarepants", 14 | "year": 1999, 15 | "creator": ["Stephen Hillenburg"], 16 | "rating": "TV-Y", 17 | "genre": ["Comedy", "Family"], 18 | "runtime_in_minutes": 23, 19 | "episodes": 272, 20 | "image": "https://nick.mtvnimages.com/uri/mgid:arc:content:nick.com:9cd2df6e-63c7-43da-8bde-8d77af9169c7?quality=0.7", 21 | "id": 1 22 | }, 23 | { 24 | "title": "The Simpsons", 25 | "year": 1999, 26 | "creator": ["Matt Groening"], 27 | "rating": "TV-PG", 28 | "genre": ["Comedy"], 29 | "runtime_in_minutes": 22, 30 | "episodes": 684, 31 | "image": "https://m.media-amazon.com/images/M/MV5BYjFkMTlkYWUtZWFhNy00M2FmLThiOTYtYTRiYjVlZWYxNmJkXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 32 | "id": 2 33 | }, 34 | { 35 | "title": "Star vs the Forces of Evil", 36 | "year": 1999, 37 | "creator": ["Stephen Hillenburg"], 38 | "rating": "TV-Y7", 39 | "genre": ["Action", "Adventure"], 40 | "runtime_in_minutes": 22, 41 | "episodes": 77, 42 | "image": "https://m.media-amazon.com/images/M/MV5BYjFkMTlkYWUtZWFhNy00M2FmLThiOTYtYTRiYjVlZWYxNmJkXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 43 | "id": 3 44 | }, 45 | { 46 | "title": "Gravity Falls", 47 | "year": 2012, 48 | "creator": ["Alex Hirsch"], 49 | "rating": "TV-Y7", 50 | "genre": ["Adventure", "Comedy"], 51 | "runtime_in_minutes": 23, 52 | "episodes": 40, 53 | "image": "https://m.media-amazon.com/images/M/MV5BMTEzNDc3MDQ2NzNeQTJeQWpwZ15BbWU4MDYzMzUwMDIx._V1_SY1000_CR0,0,641,1000_AL_.jpg", 54 | "id": 4 55 | }, 56 | { 57 | "title": "Bojack Horseman", 58 | "year": 2014, 59 | "creator": ["Raphael Bob-Waksberg"], 60 | "rating": "TV-MA", 61 | "genre": ["Drama", "Comedy"], 62 | "runtime_in_minutes": 25, 63 | "episodes": 77, 64 | "image": "https://m.media-amazon.com/images/M/MV5BYWQwMDNkM2MtODU4OS00OTY3LTgwOTItNjE2Yzc0MzRkMDllXkEyXkFqcGdeQXVyMTkxNjUyNQ@@._V1_SY1000_CR0,0,675,1000_AL_.jpg", 65 | "id": 5 66 | }, 67 | { 68 | "title": "Steven Universe", 69 | "year": 2013, 70 | "creator": ["Rebecca Sugar"], 71 | "rating": "TV-PG", 72 | "genre": ["Short", "Adventure"], 73 | "runtime_in_minutes": 11, 74 | "episodes": 175, 75 | "image": "https://m.media-amazon.com/images/M/MV5BNTNjMTM1YWYtZWQ3Yy00OGI1LWEyZjUtYTk3OTk5NGIxMzIyXkEyXkFqcGdeQXVyMzM4NjcxOTc@._V1_SY1000_CR0,0,651,1000_AL_.jpg", 76 | "id": 6 77 | }, 78 | { 79 | "title": "Adventure Time", 80 | "year": 2010, 81 | "creator": ["Pendleton Ward"], 82 | "rating": "TV-PG", 83 | "genre": ["Short", "Action"], 84 | "runtime_in_minutes": 11, 85 | "episodes": 289, 86 | "image": "https://m.media-amazon.com/images/M/MV5BMjE2MzE1MDI2M15BMl5BanBnXkFtZTgwNzUyODQxMDE@._V1_SY1000_CR0,0,731,1000_AL_.jpg", 87 | "id": 7 88 | }, 89 | { 90 | "title": "Pokemon", 91 | "year": 1997, 92 | "creator": ["Junichi Masada", "Ken Sugimori", "Satoshi Tajiri"], 93 | "rating": "TV-Y", 94 | "genre": ["Adventure", "Action"], 95 | "runtime_in_minutes": 24, 96 | "episodes": 1131, 97 | "image": "https://m.media-amazon.com/images/M/MV5BNjU1YjM2YzAtZWE2Ny00ZWNiLWFkZWItMDJhMzJiNDQwMmI4XkEyXkFqcGdeQXVyNTU1MjgyMjk@._V1_.jpg", 98 | "id": 8 99 | }, 100 | { 101 | "title": "Yu-Gi-Oh!", 102 | "year": 2000, 103 | "creator": ["Kazuki Takashi"], 104 | "rating": "TV-Y", 105 | "genre": ["Adventure", "Action"], 106 | "runtime_in_minutes": 24, 107 | "episodes": 225, 108 | "image": "https://m.media-amazon.com/images/M/MV5BMDM0MDA3NzYtMDE1MS00YjZmLWJmNjQtNzgxYzlhMmMyZjQ2XkEyXkFqcGdeQXVyNjk1Njg5NTA@._V1_SY1000_CR0,0,701,1000_AL_.jpg", 109 | "id": 9 110 | }, 111 | { 112 | "title": "Rugrats", 113 | "year": 1990, 114 | "creator": ["Gabor Csupo", "Paul Germain"], 115 | "rating": "TV-Y", 116 | "genre": ["Adventure", "Comedy"], 117 | "runtime_in_minutes": 30, 118 | "episodes": 179, 119 | "image": "https://i.kinja-img.com/gawker-media/image/upload/t_original/lseuxpzwkntjf0coatv2.jpg", 120 | "id": 10 121 | }, 122 | { 123 | "title": "My Little Pony: Friendship is Magic", 124 | "year": 2010, 125 | "creator": ["Lauren Faust", "Bonnie Zacherle"], 126 | "rating": "TV-Y", 127 | "genre": ["Adventure", "Comedy"], 128 | "runtime_in_minutes": 22, 129 | "episodes": 235, 130 | "image": "https://m.media-amazon.com/images/M/MV5BMTk4NTgxMjItZTU5ZS00NGE3LWJlODQtMTMzOTJlZmU5ODk1XkEyXkFqcGdeQXVyNjUzMDIyNzE@._V1_.jpg", 131 | "id": 11 132 | }, 133 | { 134 | "title": "Ed, Edd n Eddy", 135 | "year": 1999, 136 | "creator": ["Danny Antonucci"], 137 | "rating": "TV-Y7", 138 | "genre": ["Family", "Comedy"], 139 | "runtime_in_minutes": 30, 140 | "episodes": 80, 141 | "image": "https://m.media-amazon.com/images/M/MV5BMGFiZGI4Y2ItMzkzOC00OTE5LThlZDgtNzE1YTdmNTA5ZTZkL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyMTEwMTkwOTI@._V1_.jpg", 142 | "id": 12 143 | }, 144 | { 145 | "title": "Courage the Cowardly Dog", 146 | "year": 1999, 147 | "creator": ["John Dilworth"], 148 | "rating": "TV-Y7", 149 | "genre": ["Adventure", "Comedy"], 150 | "runtime_in_minutes": 11, 151 | "episodes": 52, 152 | "image": "https://m.media-amazon.com/images/M/MV5BMTU4MGEyNTItNzg5ZS00ZGU0LTk4NmEtODM0Y2UxYTY2YTUyXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,680,1000_AL_.jpg", 153 | "id": 13 154 | }, 155 | { 156 | "title": "Powerpuff Girls", 157 | "year": 1998, 158 | "creator": ["Craig McCracken"], 159 | "rating": "TV-Y7-FV", 160 | "genre": ["Adventure", "Action"], 161 | "runtime_in_minutes": 30, 162 | "episodes": 79, 163 | "image": "https://m.media-amazon.com/images/M/MV5BODdmZmFlMGUtZWE5NC00NmU5LTg3NzItOTNjNDc4ZTc2YzI1XkEyXkFqcGdeQXVyNjM1MTQ0NTQ@._V1_.jpg", 164 | "id": 14 165 | }, 166 | { 167 | "title": "Dexter's Lab", 168 | "year": 1996, 169 | "creator": ["Craig McCracken", "Genndy Tartakovsky"], 170 | "rating": "TV-G", 171 | "genre": ["Adventure", "Comedy"], 172 | "runtime_in_minutes": 23, 173 | "episodes": 79, 174 | "image": "https://m.media-amazon.com/images/M/MV5BMzdlMDMxNzItNmViNS00NDRkLTg3OWMtNjliZGIxY2M5N2YyXkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_.jpg", 175 | "id": 15 176 | }, 177 | { 178 | "title": "Cow and Chicken", 179 | "year": 1995, 180 | "creator": ["David Feiss"], 181 | "rating": "TV-PG", 182 | "genre": ["Adventure", "Comedy"], 183 | "runtime_in_minutes": 30, 184 | "episodes": 53, 185 | "image": "https://m.media-amazon.com/images/M/MV5BMDFkYjE4ZGYtZDkyNC00ZmFiLWJiMGYtNjlmZWVmYWEwNTZhXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,712,1000_AL_.jpg", 186 | "id": 16 187 | }, 188 | { 189 | "title": "I am Weasel", 190 | "year": 1997, 191 | "creator": ["David Feiss"], 192 | "rating": "TV-G", 193 | "genre": ["Adventure", "Short"], 194 | "runtime_in_minutes": 30, 195 | "episodes": 79, 196 | "image": "https://m.media-amazon.com/images/M/MV5BZWY0YjA1YzQtM2ViYS00ZTRiLTlmYjUtZDJhNDlkMGI5NTU1L2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,750,1000_AL_.jpg", 197 | "id": 17 198 | }, 199 | { 200 | "title": "Johnny Bravo", 201 | "year": 1997, 202 | "creator": ["Van Partible"], 203 | "rating": "TV-Y7", 204 | "genre": ["Adventure", "Comedy"], 205 | "runtime_in_minutes": 30, 206 | "episodes": 67, 207 | "image": "https://m.media-amazon.com/images/M/MV5BZWE5NjBiNDktYWI4ZC00YjA0LWE1OGEtMzVlZTg1ZTk2MmMzXkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_SY1000_CR0,0,733,1000_AL_.jpg", 208 | "id": 18 209 | }, 210 | { 211 | "title": "Kablam", 212 | "year": 1996, 213 | "creator": ["Will McRob"], 214 | "rating": "TV-Y7", 215 | "genre": ["Family", "Comedy"], 216 | "runtime_in_minutes": 30, 217 | "episodes": 48, 218 | "image": "https://m.media-amazon.com/images/M/MV5BNjE3ZTdmNTctZmYzZi00MDRmLTgzNjUtYTc1MjBiOTdjNjJlXkEyXkFqcGdeQXVyNjExODE1MDc@._V1_.jpg", 219 | "id": 19 220 | }, 221 | { 222 | "title": "Hey Arnold", 223 | "year": 1996, 224 | "creator": ["Craig Bartlett"], 225 | "rating": "TV-Y7", 226 | "genre": ["Drama", "Comedy"], 227 | "runtime_in_minutes": 15, 228 | "episodes": 103, 229 | "image": "https://m.media-amazon.com/images/M/MV5BMzhmMjE2YTYtMTc1Ni00Nzg0LWJhNTItZWZjZDNkNjRmOTAyXkEyXkFqcGdeQXVyODMyNjA3NzQ@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 230 | "id": 20 231 | }, 232 | { 233 | "title": "Angry Beavers", 234 | "year": 1996, 235 | "creator": ["Mitch Schauer", "Keith Kaczorek"], 236 | "rating": "TV-G", 237 | "genre": ["Family", "Comedy"], 238 | "runtime_in_minutes": 30, 239 | "episodes": 64, 240 | "image": "https://m.media-amazon.com/images/M/MV5BODg2MGY5MDYtMGM5MS00OTg0LWE1YmEtM2IxN2Y1YzAzNjFiXkEyXkFqcGdeQXVyODg5MjMwNTU@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 241 | "id": 21 242 | }, 243 | { 244 | "title": "CatDog", 245 | "year": 1998, 246 | "creator": ["Peter Hannan"], 247 | "rating": "TV-Y", 248 | "genre": ["Adventure", "Comedy"], 249 | "runtime_in_minutes": 23, 250 | "episodes": 67, 251 | "image": "https://www.imdb.com/title/tt0154061/mediaviewer/rm207629568", 252 | "id": 22 253 | }, 254 | { 255 | "title": "The New Adventures of Winnie the Pooh", 256 | "year": 1988, 257 | "creator": ["Karl Geurs", "Terence Harrison", "Ken Kessel"], 258 | "rating": "TV-Y", 259 | "genre": ["Adventure", "Comedy"], 260 | "runtime_in_minutes": 30, 261 | "episodes": 50, 262 | "image": "https://m.media-amazon.com/images/M/MV5BZjFkZDkwYjktMmZkNi00ZTVkLWI5ZmItZWI2MmI1NjQ1Y2U0XkEyXkFqcGdeQXVyOTg4MDk3MTQ@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 263 | "id": 23 264 | } 265 | ], 266 | "cartoons3D": [ 267 | { 268 | "title": "Reboot", 269 | "year": 1994, 270 | "creator": ["Gavin Blair", "John Grace", "Philip Mitchell"], 271 | "rating": "TV-Y7", 272 | "genre": ["Adventure", "Action"], 273 | "runtime_in_minutes": 30, 274 | "episodes": 47, 275 | "image": "https://m.media-amazon.com/images/M/MV5BMTg1NzQ3NTI0MF5BMl5BanBnXkFtZTcwMzcwOTUyMQ@@._V1_.jpg", 276 | "id": 1 277 | }, 278 | { 279 | "title": "Beast Wars", 280 | "year": 1996, 281 | "creator": ["Steve Sacks", "Colin Davies", "John Pozer"], 282 | "rating": "TV-Y7", 283 | "genre": ["Sci-Fi", "Action"], 284 | "runtime_in_minutes": 30, 285 | "episodes": 52, 286 | "image": "https://m.media-amazon.com/images/M/MV5BNDUxODg4MzE5NV5BMl5BanBnXkFtZTYwNDA0OTc4._V1_.jpg", 287 | "id": 2 288 | } 289 | ] 290 | } 291 | -------------------------------------------------------------------------------- /server/api/cartoons.json.backup: -------------------------------------------------------------------------------- 1 | { 2 | "metaData": [ 3 | { 4 | "title": "Cartoons", 5 | "longDesc": "If cartoons is what you like then boy do we have a full list of all the cartoons from the past and present and all their details including a amazingly sourced image to showcase", 6 | "desc": "A list of Cartoons from your past.", 7 | "featured": false, 8 | "categories": ["tv", "entertainment", "list"] 9 | } 10 | ], 11 | "cartoons2D": [ 12 | { 13 | "title": "Spongebob Squarepants", 14 | "year": 1999, 15 | "creator": ["Stephen Hillenburg"], 16 | "rating": "TV-Y", 17 | "genre": ["Comedy", "Family"], 18 | "runtime_in_minutes": 23, 19 | "episodes": 272, 20 | "image": "https://nick.mtvnimages.com/uri/mgid:arc:content:nick.com:9cd2df6e-63c7-43da-8bde-8d77af9169c7?quality=0.7", 21 | "id": 1 22 | }, 23 | { 24 | "title": "The Simpsons", 25 | "year": 1999, 26 | "creator": ["Matt Groening"], 27 | "rating": "TV-PG", 28 | "genre": ["Comedy"], 29 | "runtime_in_minutes": 22, 30 | "episodes": 684, 31 | "image": "https://m.media-amazon.com/images/M/MV5BYjFkMTlkYWUtZWFhNy00M2FmLThiOTYtYTRiYjVlZWYxNmJkXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 32 | "id": 2 33 | }, 34 | { 35 | "title": "Star vs the Forces of Evil", 36 | "year": 1999, 37 | "creator": ["Stephen Hillenburg"], 38 | "rating": "TV-Y7", 39 | "genre": ["Action", "Adventure"], 40 | "runtime_in_minutes": 22, 41 | "episodes": 77, 42 | "image": "https://m.media-amazon.com/images/M/MV5BYjFkMTlkYWUtZWFhNy00M2FmLThiOTYtYTRiYjVlZWYxNmJkXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 43 | "id": 3 44 | }, 45 | { 46 | "title": "Gravity Falls", 47 | "year": 2012, 48 | "creator": ["Alex Hirsch"], 49 | "rating": "TV-Y7", 50 | "genre": ["Adventure", "Comedy"], 51 | "runtime_in_minutes": 23, 52 | "episodes": 40, 53 | "image": "https://m.media-amazon.com/images/M/MV5BMTEzNDc3MDQ2NzNeQTJeQWpwZ15BbWU4MDYzMzUwMDIx._V1_SY1000_CR0,0,641,1000_AL_.jpg", 54 | "id": 4 55 | }, 56 | { 57 | "title": "Bojack Horseman", 58 | "year": 2014, 59 | "creator": ["Raphael Bob-Waksberg"], 60 | "rating": "TV-MA", 61 | "genre": ["Drama", "Comedy"], 62 | "runtime_in_minutes": 25, 63 | "episodes": 77, 64 | "image": "https://m.media-amazon.com/images/M/MV5BYWQwMDNkM2MtODU4OS00OTY3LTgwOTItNjE2Yzc0MzRkMDllXkEyXkFqcGdeQXVyMTkxNjUyNQ@@._V1_SY1000_CR0,0,675,1000_AL_.jpg", 65 | "id": 5 66 | }, 67 | { 68 | "title": "Steven Universe", 69 | "year": 2013, 70 | "creator": ["Rebecca Sugar"], 71 | "rating": "TV-PG", 72 | "genre": ["Short", "Adventure"], 73 | "runtime_in_minutes": 11, 74 | "episodes": 175, 75 | "image": "https://m.media-amazon.com/images/M/MV5BNTNjMTM1YWYtZWQ3Yy00OGI1LWEyZjUtYTk3OTk5NGIxMzIyXkEyXkFqcGdeQXVyMzM4NjcxOTc@._V1_SY1000_CR0,0,651,1000_AL_.jpg", 76 | "id": 6 77 | }, 78 | { 79 | "title": "Adventure Time", 80 | "year": 2010, 81 | "creator": ["Pendleton Ward"], 82 | "rating": "TV-PG", 83 | "genre": ["Short", "Action"], 84 | "runtime_in_minutes": 11, 85 | "episodes": 289, 86 | "image": "https://m.media-amazon.com/images/M/MV5BMjE2MzE1MDI2M15BMl5BanBnXkFtZTgwNzUyODQxMDE@._V1_SY1000_CR0,0,731,1000_AL_.jpg", 87 | "id": 7 88 | }, 89 | { 90 | "title": "Pokemon", 91 | "year": 1997, 92 | "creator": ["Junichi Masada", "Ken Sugimori", "Satoshi Tajiri"], 93 | "rating": "TV-Y", 94 | "genre": ["Adventure", "Action"], 95 | "runtime_in_minutes": 24, 96 | "episodes": 1131, 97 | "image": "https://m.media-amazon.com/images/M/MV5BNjU1YjM2YzAtZWE2Ny00ZWNiLWFkZWItMDJhMzJiNDQwMmI4XkEyXkFqcGdeQXVyNTU1MjgyMjk@._V1_.jpg", 98 | "id": 8 99 | }, 100 | { 101 | "title": "Yu-Gi-Oh!", 102 | "year": 2000, 103 | "creator": ["Kazuki Takashi"], 104 | "rating": "TV-Y", 105 | "genre": ["Adventure", "Action"], 106 | "runtime_in_minutes": 24, 107 | "episodes": 225, 108 | "image": "https://m.media-amazon.com/images/M/MV5BMDM0MDA3NzYtMDE1MS00YjZmLWJmNjQtNzgxYzlhMmMyZjQ2XkEyXkFqcGdeQXVyNjk1Njg5NTA@._V1_SY1000_CR0,0,701,1000_AL_.jpg", 109 | "id": 9 110 | }, 111 | { 112 | "title": "Rugrats", 113 | "year": 1990, 114 | "creator": ["Gabor Csupo", "Paul Germain"], 115 | "rating": "TV-Y", 116 | "genre": ["Adventure", "Comedy"], 117 | "runtime_in_minutes": 30, 118 | "episodes": 179, 119 | "image": "https://i.kinja-img.com/gawker-media/image/upload/t_original/lseuxpzwkntjf0coatv2.jpg", 120 | "id": 10 121 | }, 122 | { 123 | "title": "My Little Pony: Friendship is Magic", 124 | "year": 2010, 125 | "creator": ["Lauren Faust", "Bonnie Zacherle"], 126 | "rating": "TV-Y", 127 | "genre": ["Adventure", "Comedy"], 128 | "runtime_in_minutes": 22, 129 | "episodes": 235, 130 | "image": "https://m.media-amazon.com/images/M/MV5BMTk4NTgxMjItZTU5ZS00NGE3LWJlODQtMTMzOTJlZmU5ODk1XkEyXkFqcGdeQXVyNjUzMDIyNzE@._V1_.jpg", 131 | "id": 11 132 | }, 133 | { 134 | "title": "Ed, Edd n Eddy", 135 | "year": 1999, 136 | "creator": ["Danny Antonucci"], 137 | "rating": "TV-Y7", 138 | "genre": ["Family", "Comedy"], 139 | "runtime_in_minutes": 30, 140 | "episodes": 80, 141 | "image": "https://m.media-amazon.com/images/M/MV5BMGFiZGI4Y2ItMzkzOC00OTE5LThlZDgtNzE1YTdmNTA5ZTZkL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyMTEwMTkwOTI@._V1_.jpg", 142 | "id": 12 143 | }, 144 | { 145 | "title": "Courage the Cowardly Dog", 146 | "year": 1999, 147 | "creator": ["John Dilworth"], 148 | "rating": "TV-Y7", 149 | "genre": ["Adventure", "Comedy"], 150 | "runtime_in_minutes": 11, 151 | "episodes": 52, 152 | "image": "https://m.media-amazon.com/images/M/MV5BMTU4MGEyNTItNzg5ZS00ZGU0LTk4NmEtODM0Y2UxYTY2YTUyXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,680,1000_AL_.jpg", 153 | "id": 13 154 | }, 155 | { 156 | "title": "Powerpuff Girls", 157 | "year": 1998, 158 | "creator": ["Craig McCracken"], 159 | "rating": "TV-Y7-FV", 160 | "genre": ["Adventure", "Action"], 161 | "runtime_in_minutes": 30, 162 | "episodes": 79, 163 | "image": "https://m.media-amazon.com/images/M/MV5BODdmZmFlMGUtZWE5NC00NmU5LTg3NzItOTNjNDc4ZTc2YzI1XkEyXkFqcGdeQXVyNjM1MTQ0NTQ@._V1_.jpg", 164 | "id": 14 165 | }, 166 | { 167 | "title": "Dexter's Lab", 168 | "year": 1996, 169 | "creator": ["Craig McCracken", "Genndy Tartakovsky"], 170 | "rating": "TV-G", 171 | "genre": ["Adventure", "Comedy"], 172 | "runtime_in_minutes": 23, 173 | "episodes": 79, 174 | "image": "https://m.media-amazon.com/images/M/MV5BMzdlMDMxNzItNmViNS00NDRkLTg3OWMtNjliZGIxY2M5N2YyXkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_.jpg", 175 | "id": 15 176 | }, 177 | { 178 | "title": "Cow and Chicken", 179 | "year": 1995, 180 | "creator": ["David Feiss"], 181 | "rating": "TV-PG", 182 | "genre": ["Adventure", "Comedy"], 183 | "runtime_in_minutes": 30, 184 | "episodes": 53, 185 | "image": "https://m.media-amazon.com/images/M/MV5BMDFkYjE4ZGYtZDkyNC00ZmFiLWJiMGYtNjlmZWVmYWEwNTZhXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,712,1000_AL_.jpg", 186 | "id": 16 187 | }, 188 | { 189 | "title": "I am Weasel", 190 | "year": 1997, 191 | "creator": ["David Feiss"], 192 | "rating": "TV-G", 193 | "genre": ["Adventure", "Short"], 194 | "runtime_in_minutes": 30, 195 | "episodes": 79, 196 | "image": "https://m.media-amazon.com/images/M/MV5BZWY0YjA1YzQtM2ViYS00ZTRiLTlmYjUtZDJhNDlkMGI5NTU1L2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY1000_CR0,0,750,1000_AL_.jpg", 197 | "id": 17 198 | }, 199 | { 200 | "title": "Johnny Bravo", 201 | "year": 1997, 202 | "creator": ["Van Partible"], 203 | "rating": "TV-Y7", 204 | "genre": ["Adventure", "Comedy"], 205 | "runtime_in_minutes": 30, 206 | "episodes": 67, 207 | "image": "https://m.media-amazon.com/images/M/MV5BZWE5NjBiNDktYWI4ZC00YjA0LWE1OGEtMzVlZTg1ZTk2MmMzXkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_SY1000_CR0,0,733,1000_AL_.jpg", 208 | "id": 18 209 | }, 210 | { 211 | "title": "Kablam", 212 | "year": 1996, 213 | "creator": ["Will McRob"], 214 | "rating": "TV-Y7", 215 | "genre": ["Family", "Comedy"], 216 | "runtime_in_minutes": 30, 217 | "episodes": 48, 218 | "image": "https://m.media-amazon.com/images/M/MV5BNjE3ZTdmNTctZmYzZi00MDRmLTgzNjUtYTc1MjBiOTdjNjJlXkEyXkFqcGdeQXVyNjExODE1MDc@._V1_.jpg", 219 | "id": 19 220 | }, 221 | { 222 | "title": "Hey Arnold", 223 | "year": 1996, 224 | "creator": ["Craig Bartlett"], 225 | "rating": "TV-Y7", 226 | "genre": ["Drama", "Comedy"], 227 | "runtime_in_minutes": 15, 228 | "episodes": 103, 229 | "image": "https://m.media-amazon.com/images/M/MV5BMzhmMjE2YTYtMTc1Ni00Nzg0LWJhNTItZWZjZDNkNjRmOTAyXkEyXkFqcGdeQXVyODMyNjA3NzQ@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 230 | "id": 20 231 | }, 232 | { 233 | "title": "Angry Beavers", 234 | "year": 1996, 235 | "creator": ["Mitch Schauer", "Keith Kaczorek"], 236 | "rating": "TV-G", 237 | "genre": ["Family", "Comedy"], 238 | "runtime_in_minutes": 30, 239 | "episodes": 64, 240 | "image": "https://m.media-amazon.com/images/M/MV5BODg2MGY5MDYtMGM5MS00OTg0LWE1YmEtM2IxN2Y1YzAzNjFiXkEyXkFqcGdeQXVyODg5MjMwNTU@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 241 | "id": 21 242 | }, 243 | { 244 | "title": "CatDog", 245 | "year": 1998, 246 | "creator": ["Peter Hannan"], 247 | "rating": "TV-Y", 248 | "genre": ["Adventure", "Comedy"], 249 | "runtime_in_minutes": 23, 250 | "episodes": 67, 251 | "image": "https://www.imdb.com/title/tt0154061/mediaviewer/rm207629568", 252 | "id": 22 253 | }, 254 | { 255 | "title": "The New Adventures of Winnie the Pooh", 256 | "year": 1988, 257 | "creator": ["Karl Geurs", "Terence Harrison", "Ken Kessel"], 258 | "rating": "TV-Y", 259 | "genre": ["Adventure", "Comedy"], 260 | "runtime_in_minutes": 30, 261 | "episodes": 50, 262 | "image": "https://m.media-amazon.com/images/M/MV5BZjFkZDkwYjktMmZkNi00ZTVkLWI5ZmItZWI2MmI1NjQ1Y2U0XkEyXkFqcGdeQXVyOTg4MDk3MTQ@._V1_SY1000_CR0,0,666,1000_AL_.jpg", 263 | "id": 23 264 | } 265 | ], 266 | "cartoons3D": [ 267 | { 268 | "title": "Reboot", 269 | "year": 1994, 270 | "creator": ["Gavin Blair", "John Grace", "Philip Mitchell"], 271 | "rating": "TV-Y7", 272 | "genre": ["Adventure", "Action"], 273 | "runtime_in_minutes": 30, 274 | "episodes": 47, 275 | "image": "https://m.media-amazon.com/images/M/MV5BMTg1NzQ3NTI0MF5BMl5BanBnXkFtZTcwMzcwOTUyMQ@@._V1_.jpg", 276 | "id": 1 277 | }, 278 | { 279 | "title": "Beast Wars", 280 | "year": 1996, 281 | "creator": ["Steve Sacks", "Colin Davies", "John Pozer"], 282 | "rating": "TV-Y7", 283 | "genre": ["Sci-Fi", "Action"], 284 | "runtime_in_minutes": 30, 285 | "episodes": 52, 286 | "image": "https://m.media-amazon.com/images/M/MV5BNDUxODg4MzE5NV5BMl5BanBnXkFtZTYwNDA0OTc4._V1_.jpg", 287 | "id": 2 288 | } 289 | ] 290 | } 291 | -------------------------------------------------------------------------------- /server/apiList.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | id: 1, 4 | title: "Futurama", 5 | longDesc: 6 | "If you are a Futurama fan, then this api is for you. Here you can find everything from Episodes to Characters to Trivia Questions, and even some of the Products featured on the show.", 7 | desc: "An API with characters, episode listing, species, planets, and trivia questions.", 8 | link: "futurama", 9 | graphLink: "futurama/graphql", 10 | endPoints: ["info", "characters", "cast", "episodes", "questions", "inventory"], 11 | }, 12 | { 13 | id: 2, 14 | title: "Avatar", 15 | longDesc: 16 | "If you are an Avatar fan, then this api is for you. Here you can find everything from Episodes to Characters to Trivia Questions and more.", 17 | desc: "An API with characters, episode listings, and trivia questions.", 18 | link: "avatar", 19 | graphLink: "avatar/graphql", 20 | endPoints: ["info", "characters", "episodes", "questions"], 21 | }, 22 | { 23 | id: 3, 24 | title: "Baseball", 25 | longDesc: 26 | "Baseball fans? Computer nerds? Now, in one place, you have baseball data and an api to access it. Have fun!", 27 | desc: "An API with records and trivia questions.", 28 | link: "baseball", 29 | graphLink: "baseball/graphql", 30 | endPoints: [ 31 | "hitsSingleSeason", 32 | "hitsCareer", 33 | "eraSingleSeason", 34 | "eraCareer", 35 | "stolenBasesSingleSeason", 36 | "stolenBasesCareer", 37 | "battingAvgsSingleSeason", 38 | "battingAvgsCareer", 39 | "rbiSingleSeason", 40 | "rbiCareer", 41 | ], 42 | }, 43 | { 44 | id: 4, 45 | title: "Recipes", 46 | longDesc: "Because everyone is making a recipe app to learn to code. So, here is some data.", 47 | desc: "A recipe database", 48 | link: "recipes", 49 | graphLink: "recipes/graphql", 50 | endPoints: ["recipes"], 51 | }, 52 | { 53 | id: 5, 54 | title: "FakeBank", 55 | longDesc: 56 | "Building an app that needs some bake transactions? Well, look no further. Here are what Fry's bank statements might look like from the future.", 57 | desc: "Just a random set of fake bank data.", 58 | link: "fakebank", 59 | graphLink: "fakebank/graphql", 60 | endPoints: ["Accounts"], 61 | }, 62 | { 63 | id: 6, 64 | title: "Football", 65 | longDesc: 66 | "Football fans? Computer nerds? Now, in one place, you have football data and an api to access it. Have fun!", 67 | desc: "An API with records and trivia questions.", 68 | link: "football", 69 | graphLink: "football/graphql", 70 | endPoints: ["passingyards-singleseason", "passingyards-career", "passingtd-singleseason", "passingtd-career"], 71 | }, 72 | { 73 | id: 7, 74 | title: "Countries", 75 | longDesc: 76 | "Who doesn't need to get the dreaded long list of countries, codes, capitals, etc. every other week? You can get them all right here.", 77 | desc: "An API with information about countries.", 78 | link: "countries", 79 | graphLink: "countries/graphql", 80 | endPoints: ["countries"], 81 | }, 82 | { 83 | id: 8, 84 | title: "Presidents", 85 | longDesc: 86 | "Millions of peaches! No...not those Presidents. You're practicing API calls, why not learn a little bit about United States history in the process? Here we have a collection of all the US Presidents. Updated every 4-8 years.", 87 | desc: "Millions of peaches! No...not those Presidents...", 88 | link: "presidents", 89 | graphLink: "presidents/graphql", 90 | endPoints: ["presidents"], 91 | }, 92 | { 93 | id: 9, 94 | title: "Simpsons", 95 | longDesc: "Because who doesn't need easily accessible data about the simpsons?", 96 | desc: "Because who doesn't need easily accessible data about the simpsons?", 97 | link: "simpsons", 98 | graphLink: "simpsons/graphql", 99 | endPoints: ["characters", "products", "episodes"], 100 | }, 101 | { 102 | id: 11, 103 | title: "Movies", 104 | longDesc: "Movies.", 105 | desc: "Movies.", 106 | link: "movies", 107 | graphLink: "movies/graphql", 108 | endPoints: [ 109 | "action-adventure", 110 | "animation", 111 | "classic", 112 | "comedy", 113 | "drama", 114 | "horror", 115 | "family", 116 | "mystery", 117 | "scifi-fantasy", 118 | "western", 119 | ], 120 | }, 121 | { 122 | id: 12, 123 | title: "Wines", 124 | longDesc: "Wines.", 125 | desc: "Wines", 126 | link: "wines", 127 | graphLink: "wines/graphql", 128 | endPoints: ["reds", "whites", "sparkling", "rose", "desert", "port"], 129 | }, 130 | { 131 | id: 13, 132 | title: "Health", 133 | longDesc: 134 | "Sometimes health data is hard to come by. This endpoints make it easy for you to test your apps with examples of health data such as medical professions.", 135 | desc: "An API with health and medical information", 136 | link: "health", 137 | graphLink: "health/graphql", 138 | endPoints: ["professions"], 139 | }, 140 | { 141 | id: 13, 142 | title: "Beers", 143 | longDesc: "Beers.", 144 | desc: "Beers", 145 | link: "beers", 146 | graphLink: "beers/graphql", 147 | endPoints: ["ale", "stout", "red-ale"], 148 | }, 149 | { 150 | id: 14, 151 | title: "Switch Games", 152 | longDesc: "Figured it would be a cool db to have various video games on the Switch.", 153 | desc: "Figured it would be fun to have a Switch game list on here.", 154 | link: "switch", 155 | graphLink: "switch/graphql", 156 | endPoints: ["games"], 157 | }, 158 | { 159 | id: 15, 160 | title: "PlayStation Games", 161 | longDesc: "Figured it would be a cool db to have various video games on the PlayStation 4.", 162 | desc: "Figured it would be fun to have a PlayStation game list on here.", 163 | link: "playstation", 164 | graphLink: "playstation/graphql", 165 | endPoints: ["games"], 166 | }, 167 | { 168 | id: 16, 169 | title: "XBox Games", 170 | longDesc: "Figured it would be a cool db to have various video games on the XBox.", 171 | desc: "Figured it would be fun to have a Xbox game list on here.", 172 | link: "xbox", 173 | graphLink: "xbox/graphql", 174 | endPoints: ["games"], 175 | }, 176 | { 177 | id: 17, 178 | title: "Typer", 179 | longDesc: "A place to hold lessons for Typer", 180 | desc: "A place to hold lessons for Typer", 181 | link: "typer", 182 | graphLink: "typer/graphql", 183 | endPoints: ["welcomeQuestions", "webLessons", "typingLessons"], 184 | }, 185 | { 186 | id: 18, 187 | title: "CSS Color Names", 188 | longDesc: 189 | "Thought it would be cool to include different CSS Colors Names. I was inspired when I found this site, https://xkcd.com/color/rgb/.", 190 | desc: "A list of CSS Color Names", 191 | link: "csscolornames", 192 | graphLink: "csscolornames/graphql", 193 | endPoints: ["colors"], 194 | }, 195 | { 196 | id: 19, 197 | title: "The United States", 198 | longDesc: 199 | "Info about the all the 50 states in the United States. The endpoint includes the name, abbreviation, capital, largest city, date admitted to union, population, and state flag.", 200 | desc: "Info about the all the 50 states in the United States.", 201 | link: "thestates", 202 | graphLink: "thestates/graphql", 203 | endPoints: ["the-states"], 204 | }, 205 | { 206 | id: 20, 207 | title: "Cartoons", 208 | longDesc: 209 | "If cartoons is what you like then boy do we have a full list of all the cartoons from the past and present and all their details including a amazingly sourced image to showcase", 210 | desc: "A list of Cartoons from your past.", 211 | link: "cartoons", 212 | graphLink: "cartoons/graphql", 213 | endPoints: ["cartoons2D", "cartoons3D"], 214 | }, 215 | { 216 | id: 21, 217 | title: "Coding Resources", 218 | longDesc: 219 | "Women Who Code.com is an amazing community and organization. They have an amazing resource in https://www.womenwhocode.com/resources. Here you'll find their 170 resources in an API for easy search, list and share. Please give a link BACK to WomenWhoCode.com if you use this information.", 220 | desc: "API for all coding resources from https://www.womenwhocode.com/resources", 221 | link: "codingresources", 222 | graphLink: "codingresources/graphql", 223 | endPoints: ["codingresources"], 224 | }, 225 | { 226 | id: 22, 227 | title: "Rick And Morty", 228 | longDesc: 229 | "Get all the Rick-iest Episodes, Locations and Characters from a copy of the https://rickandmortyapi.com data. That's the way Rick would have done it!", 230 | desc: "API for all current Rick & Morty episodes, locations and characters", 231 | link: "rickandmorty", 232 | graphLink: "rickandmorty/graphql", 233 | endPoints: ["characters", "episodes", "locations"], 234 | }, 235 | { 236 | id: 23, 237 | title: "Coffee", 238 | longDesc: "Basic list of descriptions and ingredients used for the most popular coffee drinks", 239 | desc: "API for popular coffee drinks", 240 | link: "coffee", 241 | graphLink: "coffee/graphql", 242 | endPoints: ["hot", "iced"], 243 | }, 244 | { 245 | id: 24, 246 | title: "monstersanctuary", 247 | longDesc: "monstersanctuary", 248 | desc: "monstersanctuary", 249 | link: "monstersanctuary", 250 | graphLink: "monstersanctuary/graphql", 251 | endPoints: ["games"], 252 | }, 253 | { 254 | id: 25, 255 | title: "Jokes (good and bad)", 256 | longDesc: "Sometimes you need a list of great Jokes", 257 | desc: "An API with jokes. Mostly bad, but some good ones ;-P", 258 | link: "jokes", 259 | graphLink: "jokes/graphql", 260 | endPoints: ["goodJokes"], 261 | }, 262 | { 263 | id: 25, 264 | title: "Bitcoin (historical data)", 265 | longDesc: "You've wanted it and now we got it. Going back from January 2022 to August 2010", 266 | desc: "Bitcoin Historical Data from August 2010 to January 2022", 267 | link: "bitcoin", 268 | graphLink: "bitcoin/graphql", 269 | endPoints: ["historical_prices"], 270 | }, 271 | ]; 272 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sampleapis-server", 3 | "version": "2.8.0", 4 | "main": "sampleapis.js", 5 | "author": "Jeremy 'Jermbo' Lawson", 6 | "description": "", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/jermbo/SampleAPIs.git" 11 | }, 12 | "keywords": [ 13 | "RESTful", 14 | "Learning" 15 | ], 16 | "scripts": { 17 | "start": "node ./sampleapis.js", 18 | "server": "nodemon ./sampleapis.js", 19 | "test": "jest" 20 | }, 21 | "homepage": "https://github.com/jermbo/SampleAPIs#readme", 22 | "dependencies": { 23 | "body-parser": "^1.20.2", 24 | "express": "^4.21.1", 25 | "express-rate-limit": "^7.2.0", 26 | "express-slow-down": "^2.0.3", 27 | "json-graphql-server": "2.4.0", 28 | "json-server": "^0.17.4", 29 | "morgan": "^1.10.0", 30 | "node-fetch": "^3.3.2", 31 | "pug": "^3.0.3" 32 | }, 33 | "devDependencies": { 34 | "concurrently": "^8.2.2", 35 | "jest": "^29.7.0", 36 | "nodemon": "^3.1.1" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/public/assets/images/poster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/server/public/assets/images/poster.jpg -------------------------------------------------------------------------------- /server/public/assets/images/poster.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/server/public/assets/images/poster.psd -------------------------------------------------------------------------------- /server/public/assets/images/screenshot-sampleAPI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jermbo/SampleAPIs/f68b0f4e2631568afd900e9fcf44cb73ad50b84c/server/public/assets/images/screenshot-sampleAPI.png -------------------------------------------------------------------------------- /server/public/assets/styles/code.css: -------------------------------------------------------------------------------- 1 | .code-group { 2 | position: relative; 3 | } 4 | 5 | .code-group textarea { 6 | position: absolute; 7 | z-index: -1; 8 | width: 100%; 9 | height: 100%; 10 | top: 0; 11 | left: 0; 12 | } 13 | 14 | code { 15 | position: relative; 16 | top: 0; 17 | left: 0; 18 | width: 100%; 19 | display: block; 20 | z-index: 5; 21 | max-height: 70vh; 22 | padding: 16px 16px 16px 48px; 23 | background-color: #234; 24 | font-family: monospace; 25 | border-radius: 2px; 26 | box-shadow: 0 4px 7px -2px rgba(0, 0, 0, 0.4); 27 | outline: none; 28 | counter-reset: step; 29 | overflow-y: auto; 30 | } 31 | 32 | code::-webkit-scrollbar { 33 | width: 6px; 34 | } 35 | 36 | code::-webkit-scrollbar-thumb { 37 | background-color: rgba(255, 255, 255, 0.3); 38 | } 39 | 40 | code p { 41 | display: block; 42 | position: relative; 43 | line-height: 16px; 44 | white-space: pre-wrap; 45 | margin: 10px 0; 46 | letter-spacing: 1px; 47 | } 48 | 49 | code p::before { 50 | content: counter(step); 51 | counter-increment: step; 52 | position: absolute; 53 | right: calc(100% + 16px); 54 | color: #678; 55 | } 56 | 57 | code .methods { 58 | color: #90caf9; 59 | } 60 | 61 | code .js1 { 62 | color: #e68; 63 | } 64 | 65 | code .js2 { 66 | color: #7ff; 67 | font-style: italic; 68 | } 69 | 70 | code .js-num { 71 | color: #a7c; 72 | } 73 | 74 | code .func-name { 75 | color: #6e6; 76 | } 77 | 78 | code .string, 79 | code .string * { 80 | color: #00e676; 81 | } 82 | 83 | code .func-args, 84 | code .func-args * { 85 | color: #ffa500; 86 | } 87 | 88 | code .comment, 89 | code .comment * { 90 | color: #999; 91 | } 92 | 93 | main.not-found { 94 | display: block; 95 | background: rgb(2,214,233); 96 | background: linear-gradient(180deg, rgba(2,214,233,1) 0%, rgba(249,248,113,1) 100%); 97 | height: 100vh; 98 | padding: 5vh 10vw; 99 | font-size: 1.5rem; 100 | } 101 | main.not-found code { 102 | white-space: pre-wrap; 103 | padding: 0; 104 | letter-spacing: 0.1rem; 105 | line-height: 2em; 106 | font-size: 1.5rem; 107 | background: none; 108 | box-shadow: none; 109 | font-weight: bold; 110 | } 111 | 112 | main.not-found a { 113 | color: #11bbb2; 114 | } 115 | 116 | .copy { 117 | position: absolute; 118 | top: 0; 119 | right: 0; 120 | z-index: 12; 121 | } 122 | 123 | /* ------ */ 124 | .copied { 125 | background: #234; 126 | position: absolute; 127 | top: 0; 128 | left: 0; 129 | display: flex; 130 | justify-content: center; 131 | align-items: center; 132 | width: 100%; 133 | height: 100%; 134 | z-index: 1; 135 | } 136 | 137 | .fadeAway { 138 | animation: fade 2s ease 1 forwards; 139 | } 140 | 141 | @keyframes fade { 142 | 143 | 0%, 144 | 100% { 145 | opacity: 0; 146 | z-index: 1; 147 | } 148 | 149 | 5% { 150 | opacity: 1; 151 | z-index: 10; 152 | } 153 | 154 | 75% { 155 | opacity: 1; 156 | z-index: 10; 157 | } 158 | 159 | 90% { 160 | opacity: .1; 161 | z-index: 10; 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /server/public/assets/styles/home-styles.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Montserrat+Alternates:200,400,600,800"); 2 | *, 3 | *:before, 4 | *:after { 5 | box-sizing: border-box; 6 | } 7 | 8 | html, 9 | body { 10 | margin: 0; 11 | padding: 0; 12 | height: 100vh; 13 | font-family: "Montserrat Alternates", sans-serif; 14 | font-size: 16px; 15 | } 16 | 17 | main { 18 | display: flex; 19 | background: #161616; 20 | height: 100%; 21 | } 22 | 23 | a { 24 | color: #15e3d9; 25 | } 26 | 27 | .disclaimer { 28 | font-size: 0.75rem; 29 | } 30 | 31 | .site { 32 | flex: 1; 33 | display: flex; 34 | color: #eadeda; 35 | align-items: center; 36 | justify-content: center; 37 | } 38 | 39 | .site__inner { 40 | padding: 0 1.25rem; 41 | max-width: 60vw; 42 | } 43 | 44 | .page__inner { 45 | padding: 0 1.25rem; 46 | width: 100vw; 47 | } 48 | 49 | .site__title { 50 | font-weight: 400; 51 | } 52 | 53 | .backBtn { 54 | background: #00d6e9; 55 | display: inline-block; 56 | padding: 0.125rem 0.625rem; 57 | color: #161616; 58 | text-decoration: none; 59 | transition: all 0.2s ease; 60 | } 61 | 62 | .backBtn:hover { 63 | color: #eadeda; 64 | background: #00909d; 65 | } 66 | 67 | .apis { 68 | flex: 1; 69 | max-height: 100%; 70 | display: flex; 71 | overflow-y: auto; 72 | flex-direction: column; 73 | } 74 | 75 | .api { 76 | flex: 1 0 auto; 77 | display: flex; 78 | padding: 1.25rem; 79 | color: #161616; 80 | align-items: center; 81 | } 82 | .api:nth-child(6n + 1) { 83 | background: #00d6e9; 84 | } 85 | .api:nth-child(6n + 2) { 86 | background: #15e3d9; 87 | } 88 | .api:nth-child(6n + 3) { 89 | background: #56edbf; 90 | } 91 | .api:nth-child(6n + 4) { 92 | background: #8cf5a2; 93 | } 94 | .api:nth-child(6n + 5) { 95 | background: #c2f985; 96 | } 97 | .api:nth-child(6n + 6) { 98 | background: #f9f871; 99 | } 100 | 101 | .api__title { 102 | margin: 0 0 0.625rem; 103 | } 104 | 105 | .api__desc { 106 | margin: 0 0 0.625rem; 107 | } 108 | 109 | .api__link { 110 | color: #161616; 111 | text-decoration: none; 112 | display: inline-block; 113 | padding: 0.3125rem 0.625rem; 114 | border: 1px solid #161616; 115 | margin: 0 0.1123rem; 116 | transition: all 0.2s ease; 117 | } 118 | .api:nth-child(6n + 1) .api__link { 119 | background: #00d6e9; 120 | } 121 | .api:nth-child(6n + 1) .api__link:hover { 122 | color: black; 123 | border-color: black; 124 | background: #00909d; 125 | } 126 | .api:nth-child(6n + 2) .api__link { 127 | background: #15e3d9; 128 | } 129 | .api:nth-child(6n + 2) .api__link:hover { 130 | color: black; 131 | border-color: black; 132 | background: #0f9d96; 133 | } 134 | .api:nth-child(6n + 3) .api__link { 135 | background: #56edbf; 136 | } 137 | .api:nth-child(6n + 3) .api__link:hover { 138 | color: #073d2d; 139 | border-color: #073d2d; 140 | background: #18dfa2; 141 | } 142 | .api:nth-child(6n + 4) .api__link { 143 | background: #8cf5a2; 144 | } 145 | .api:nth-child(6n + 4) .api__link:hover { 146 | color: #0a7821; 147 | border-color: #0a7821; 148 | background: #46ef69; 149 | } 150 | .api:nth-child(6n + 5) .api__link { 151 | background: #c2f985; 152 | } 153 | .api:nth-child(6n + 5) .api__link:hover { 154 | color: #427906; 155 | border-color: #427906; 156 | background: #9ef53c; 157 | } 158 | .api:nth-child(6n + 6) .api__link { 159 | background: #f9f871; 160 | } 161 | .api:nth-child(6n + 6) .api__link:hover { 162 | color: #676604; 163 | border-color: #676604; 164 | background: #f6f428; 165 | } 166 | 167 | .endpoint { 168 | text-decoration: none; 169 | display: inline-block; 170 | padding: 0.625rem 1.25rem; 171 | margin: 0 0.625rem 0.625rem 0; 172 | transition: all 0.2s ease; 173 | } 174 | .endpoint:nth-child(6n + 1) { 175 | background: #00d6e9; 176 | color: black; 177 | } 178 | .endpoint:nth-child(6n + 1):hover { 179 | color: #50f1ff; 180 | border-color: black; 181 | background: #00909d; 182 | } 183 | .endpoint:nth-child(6n + 2) { 184 | background: #15e3d9; 185 | color: black; 186 | } 187 | .endpoint:nth-child(6n + 2):hover { 188 | color: #6df1eb; 189 | border-color: black; 190 | background: #0f9d96; 191 | } 192 | .endpoint:nth-child(6n + 3) { 193 | background: #56edbf; 194 | color: #073d2d; 195 | } 196 | .endpoint:nth-child(6n + 3):hover { 197 | color: #b2f7e2; 198 | border-color: #073d2d; 199 | background: #18dfa2; 200 | } 201 | .endpoint:nth-child(6n + 4) { 202 | background: #8cf5a2; 203 | color: #0a7821; 204 | } 205 | .endpoint:nth-child(6n + 4):hover { 206 | color: #eafdee; 207 | border-color: #0a7821; 208 | background: #46ef69; 209 | } 210 | .endpoint:nth-child(6n + 5) { 211 | background: #c2f985; 212 | color: #427906; 213 | } 214 | .endpoint:nth-child(6n + 5):hover { 215 | color: #f3fee6; 216 | border-color: #427906; 217 | background: #9ef53c; 218 | } 219 | .endpoint:nth-child(6n + 6) { 220 | background: #f9f871; 221 | color: #676604; 222 | } 223 | .endpoint:nth-child(6n + 6):hover { 224 | color: #fdfdd3; 225 | border-color: #676604; 226 | background: #f6f428; 227 | } 228 | /* ----- */ 229 | 230 | .form-group { 231 | display: flex; 232 | flex-direction: column; 233 | } 234 | 235 | input, 236 | textarea { 237 | padding: 1rem; 238 | margin-top: .5rem; 239 | } 240 | 241 | -------------------------------------------------------------------------------- /server/public/assets/styles/styles.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=PT+Sans:400,700"); 2 | :root { 3 | --primary-color: rgba(40, 150, 240, 0.9); 4 | --secondary-color: rgba(80, 170, 70, 0.9); 5 | --background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/54887/wild-sea.png); 6 | --background-deg: -45deg; 7 | --text-color-light: #e5e5e5; 8 | --box-shadow: rgba(0, 0, 0, 0.5); 9 | --light-bg: rgba(0, 153, 255, 0.555); 10 | --padding: 1.25rem; 11 | } 12 | 13 | *, 14 | *:before, 15 | *:after { 16 | box-sizing: border-box; 17 | } 18 | 19 | body { 20 | font-family: "PT-Sans", sans-serif; 21 | background: linear-gradient( 22 | var(--background-deg), 23 | var(--primary-color), 24 | var(--secondary-color) 25 | ), 26 | var(--background-image); 27 | background-blend-mode: color-burn; 28 | min-height: calc(100vh - 100px); 29 | margin: 50px 0; 30 | } 31 | 32 | .container { 33 | width: 75vw; 34 | margin: 0 auto; 35 | color: var(--text-color-light); 36 | } 37 | 38 | .form-area { 39 | grid-row: 3; 40 | display: grid; 41 | grid-template-columns: repeat(12, 1fr); 42 | grid-auto-flow: dense; 43 | grid-gap: 0.5rem 1rem; 44 | } 45 | 46 | .form-area > * { 47 | grid-column: 1 / -1; 48 | } 49 | 50 | .half { 51 | grid-column: span 6; 52 | } 53 | 54 | .third { 55 | grid-column: span 4; 56 | } 57 | 58 | .quarter { 59 | grid-column: span 3; 60 | } 61 | 62 | input, 63 | textarea, 64 | select { 65 | width: 100%; 66 | display: inline-block; 67 | padding: 5px 10px; 68 | } 69 | 70 | .btn { 71 | box-shadow: 0 3px 3px var(--box-shadow); 72 | border: 0; 73 | padding: 10px; 74 | width: 100%; 75 | color: var(--text-color-light); 76 | } 77 | 78 | .btn-primary { 79 | background: var(--secondary-color); 80 | } 81 | 82 | .btn-secondary { 83 | background: var(--primary-color); 84 | } 85 | 86 | .title { 87 | font-weight: 700; 88 | font-size: 1.5rem; 89 | text-shadow: 0 3px 3px var(--box-shadow); 90 | text-align: center; 91 | transition: all 0.25s ease; 92 | } 93 | 94 | .title a { 95 | color: var(--text-color-light); 96 | text-decoration: none; 97 | } 98 | 99 | .title small { 100 | display: block; 101 | text-shadow: 0 2px 1px var(--box-shadow); 102 | transition: all 0.25s ease; 103 | font-size: 0.5em; 104 | font-weight: 400; 105 | } 106 | 107 | .title:hover { 108 | text-shadow: 0 5px 5px var(--box-shadow); 109 | } 110 | 111 | .title:hover small { 112 | text-shadow: 0 5px 5px var(--box-shadow); 113 | } 114 | 115 | .sub-title { 116 | font-weight: 700; 117 | font-size: 1.5rem; 118 | text-shadow: 0 3px 3px var(--box-shadow); 119 | transition: all 0.25s ease; 120 | } 121 | 122 | .sub-title:hover { 123 | text-shadow: 0 5px 5px var(--box-shadow); 124 | } 125 | 126 | .main-nav { 127 | display: flex; 128 | justify-content: space-between; 129 | margin: 0 0 var(--padding); 130 | } 131 | 132 | .main-nav a { 133 | color: var(--text-color-light); 134 | text-decoration: none; 135 | display: inline-block; 136 | padding: calc(var(--padding) / 2) var(--padding); 137 | background: var(--light-bg); 138 | transition: all 0.2s ease; 139 | } 140 | 141 | .main-nav a:hover { 142 | background: var(--primary-color); 143 | } 144 | 145 | label { 146 | display: inline-block; 147 | margin-bottom: calc(var(--padding) / 2); 148 | } 149 | 150 | select { 151 | width: 100%; 152 | } 153 | 154 | input[type="radio"], 155 | input[type="checkbox"] { 156 | display: inline-block; 157 | float: right; 158 | width: 15px; 159 | margin-left: 5px; 160 | } 161 | 162 | .group { 163 | float: left; 164 | margin-right: 15px; 165 | } 166 | 167 | h5 { 168 | margin: 5px 0; 169 | } 170 | 171 | .endpoint { 172 | display: block; 173 | text-decoration: none; 174 | color: var(--text-color-light); 175 | text-shadow: 0 3px 3px var(--box-shadow); 176 | transition: all 0.2s ease; 177 | } 178 | 179 | .endpoint:hover { 180 | text-shadow: 0 1px 1px var(--box-shadow); 181 | } 182 | -------------------------------------------------------------------------------- /server/public/scripts/CodeHighlight.js: -------------------------------------------------------------------------------- 1 | function CodeHighlight(_parent) { 2 | let parent; 3 | let copy; 4 | let copyConfirmation; 5 | 6 | const strReg1 = /"(.*?)"/g; 7 | const strReg2 = /'(.*?)'/g; 8 | const strReg3 = /`(.*?)`/g; 9 | const tempLit = /`${(.*?)}`/g; 10 | const numReg = /\b(\d+)/g; 11 | const jsReg1 = /\b(new|if|else|do|while|switch|for|foreach|in|continue|break|return|typeof)(?=[^\w])/g; 12 | const methods = /(fetch|\.then|\.catch|\.json|\.log)/g; 13 | const things = /(err|resp|data)/g; 14 | const jsReg2 = /\b(document|window|Array|String|Object|Number|Function|function|var|const|let|fetch\.\w+)(?=[^\w])/g; 15 | const funcReg = /\b(function<\/span>)(\s+\w+)(\()(.*?)(?=[\)])(?=[^\w])/g; 16 | const urlReg = /("https:\/\/.*")/g; 17 | const commentReg = /(\/\/\/.*)/g; 18 | 19 | function init() { 20 | selectDOM(); 21 | highlight(); 22 | addEventListeners(); 23 | } 24 | 25 | function selectDOM() { 26 | parent = typeof _parent == "string" ? document.querySelector(_parent) : _parent; 27 | copy = parent.querySelector(".copy"); 28 | copyConfirmation = parent.querySelector(".copied"); 29 | } 30 | 31 | function addEventListeners() { 32 | copy.addEventListener("click", (e) => { 33 | e.preventDefault(); 34 | copyFunc(); 35 | copyConfirmation.classList.add("fadeAway"); 36 | }); 37 | 38 | copyConfirmation.addEventListener("animationend", (e) => { 39 | copyConfirmation.classList.remove("fadeAway"); 40 | }); 41 | } 42 | 43 | function highlight() { 44 | const code = [...parent.querySelectorAll("code p")]; 45 | code.map(c => { 46 | let string = c.innerText; 47 | let parsed = string.replace(/[ \t]/g, " "); 48 | parsed = parsed.replace(strReg1, "\"$1\""); 49 | parsed = parsed.replace(strReg2, "'$1'"); 50 | parsed = parsed.replace(strReg3, "`$1`"); 51 | parsed = parsed.replace(tempLit, "$1"); 52 | parsed = parsed.replace(jsReg1, "$1"); 53 | parsed = parsed.replace(jsReg2, "$1"); 54 | parsed = parsed.replace(things, "$1"); 55 | parsed = parsed.replace(methods, "$1"); 56 | parsed = parsed.replace(numReg, "$1"); 57 | parsed = parsed.replace(funcReg, "$1$2$3$4"); 58 | parsed = parsed.replace(commentReg, "$1"); 59 | parsed = parsed.split("\n").join("
"); 60 | c.innerHTML = parsed; 61 | }); 62 | } 63 | 64 | function copyFunc() { 65 | var code = parent.querySelector("code").innerText; 66 | var copyText = parent.querySelector("textarea"); 67 | copyText.value = code; 68 | copyText.select(); 69 | copyText.setSelectionRange(0, 99999); 70 | document.execCommand("copy"); 71 | } 72 | 73 | init(); 74 | } 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /server/routes/base-apis.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const path = require("path"); 4 | const jsonServer = require("json-server"); 5 | const jsonGraphqlExpress = require("json-graphql-server"); 6 | 7 | const { apiLimits } = require("../utils/rateLimiterDefaults"); 8 | const { getFromFile } = require("../utils/utils"); 9 | 10 | const { verifyData } = require("../utils/verifyData"); 11 | const GeneratedAPIList = require("../GeneratedAPIList"); 12 | 13 | const init = async () => { 14 | GeneratedAPIList.forEach(({ link }) => { 15 | const dataPath = path.join(__dirname, `../api/${link}.json`); 16 | const data = getFromFile(dataPath); 17 | 18 | try { 19 | router.use(`/${link}/graphql`, apiLimits, jsonGraphqlExpress.default(data)); 20 | } catch (err) { 21 | console.log(`Unable to set up /${link}/graphql`); 22 | console.error(err); 23 | } 24 | 25 | router.use(`/${link}`, verifyData, apiLimits, jsonServer.router(dataPath)); 26 | }); 27 | }; 28 | 29 | init(); 30 | 31 | module.exports = router; 32 | -------------------------------------------------------------------------------- /server/routes/create-apis.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const fs = require("fs"); 3 | const path = require("path"); 4 | 5 | const router = express.Router(); 6 | const directoryPath = path.join(__dirname, "../custom"); 7 | 8 | router.get("/", (req, res) => { 9 | res.render("create"); 10 | }); 11 | 12 | router.post("/", async (req, res) => { 13 | const { endpointName, endpoints } = req.body; 14 | 15 | const files = await fs.readdirSync(directoryPath); 16 | const exists = files.filter((file) => { 17 | const fileName = file.split(".")[0].toLowerCase(); 18 | return fileName == endpointName; 19 | })[0]; 20 | 21 | if (exists) { 22 | res.json({ 23 | status: 409, 24 | message: `File with name: '${endpointName}' already exists. Please try a different name.`, 25 | }); 26 | return; 27 | } 28 | 29 | const baseData = endpoints.reduce((acc, name) => { 30 | const obj = acc; 31 | obj[name] = [{ id: 0, name: "test" }]; 32 | return obj; 33 | }, {}); 34 | 35 | if (!exists) { 36 | fs.writeFileSync(path.join(__dirname, `../custom/${endpointName}.json`), JSON.stringify(baseData)); 37 | } 38 | 39 | res.json({ 40 | status: 201, 41 | message: "File was created!", 42 | }); 43 | }); 44 | 45 | module.exports = router; 46 | -------------------------------------------------------------------------------- /server/routes/custom-apis.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const fs = require("fs"); 3 | const path = require("path"); 4 | const jsonServer = require("json-server"); 5 | const jsonGraphqlExpress = require("json-graphql-server"); 6 | 7 | const { apiLimits } = require("../utils/rateLimiterDefaults"); 8 | const { getFromFile } = require("../utils/utils"); 9 | 10 | const router = express.Router(); 11 | 12 | let CustomEndpoints = []; 13 | const directoryPath = path.join(__dirname, "../custom"); 14 | 15 | const init = async () => { 16 | CustomEndpoints = []; 17 | await createFileMetaData(); 18 | registerCustomLandingPages(); 19 | registerCustomEndPoints(); 20 | }; 21 | 22 | const createFileMetaData = async () => { 23 | const files = await fs.readdirSync(directoryPath); 24 | CustomEndpoints = files.map((file) => { 25 | if (file.includes(".json")) { 26 | console.log("Custom url:" + file); 27 | const data = JSON.parse(fs.readFileSync(path.join(__dirname, `../custom/${file}`))); 28 | const endPoints = Object.keys(data); 29 | const name = file.split(".")[0].toLowerCase(); 30 | 31 | return { 32 | name, 33 | link: name, 34 | endPoints, 35 | }; 36 | } else { 37 | return null; 38 | } 39 | }); 40 | 41 | //TODO - do something with "CustomEndpoints"... 42 | }; 43 | 44 | const registerCustomLandingPages = () => { 45 | router.get("/:id", (req, res) => { 46 | const id = req.params.id.toLowerCase(); 47 | const data = CustomEndpoints.filter((endpoint) => endpoint.name === id)[0]; 48 | 49 | if (data) { 50 | res.render("custom", { 51 | ...data, 52 | }); 53 | } else { 54 | init(); 55 | res.render("404-custom", { 56 | id, 57 | }); 58 | } 59 | }); 60 | }; 61 | 62 | const registerCustomEndPoints = () => { 63 | CustomEndpoints.forEach((endpoint) => { 64 | if (endpoint) { 65 | const { name } = endpoint; 66 | const file = path.join(__dirname, `../custom/${name}.json`); 67 | router.use(`/${name}/api`, apiLimits, jsonServer.router(file)); 68 | 69 | let data = getFromFile(file); 70 | try { 71 | router.use(`/${name}/graphql`, apiLimits, jsonGraphqlExpress.default(data)); 72 | } catch (err) { 73 | console.log(`Unable to set up /custom/${name}/graphql`); 74 | console.error(err); 75 | } 76 | } 77 | }); 78 | }; 79 | 80 | init(); 81 | module.exports = router; 82 | -------------------------------------------------------------------------------- /server/routes/frontend.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | 4 | const GeneratedAPIList = require("../GeneratedAPIList"); 5 | 6 | router.get("/", async (req, res) => { 7 | res.json({ 8 | status: 200, 9 | data: { 10 | APIListData: GeneratedAPIList, 11 | }, 12 | }); 13 | }); 14 | 15 | router.get("/:name", async (req, res) => { 16 | res.json({ 17 | data: 200, 18 | id: req.params.name, 19 | }); 20 | }); 21 | 22 | module.exports = router; 23 | -------------------------------------------------------------------------------- /server/routes/reset.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const path = require("path"); 3 | const fs = require("fs"); 4 | const router = express.Router(); 5 | 6 | const { getAPIListData } = require("../utils/getAPIListData"); 7 | 8 | let APIListData = []; 9 | 10 | // Reset API Route 11 | router.get("/all", async (req, res) => { 12 | console.log("Resetting endpoints") 13 | if (!APIListData.length) { 14 | APIListData = await getAPIListData(); 15 | } 16 | 17 | APIListData.forEach((page) => { 18 | const api = page.link; 19 | 20 | const backupFile = path.join(__dirname, `../api/${api}.json.backup`); 21 | const mainFile = path.join(__dirname, `../api/${api}.json`); 22 | 23 | fs.copyFile(backupFile, mainFile, (err) => { 24 | if (err) { 25 | console.log(err); 26 | } 27 | }); 28 | }); 29 | 30 | res.render("api-reset", { 31 | title: "Reset Everything", 32 | }); 33 | process.exit(1); 34 | }); 35 | 36 | // Main EndPoint Route 37 | router.get("/:id", async (req, res) => { 38 | if (!APIListData.length) { 39 | APIListData = await getAPIListData(); 40 | } 41 | 42 | const id = req.params.id.toLowerCase(); 43 | const data = APIListData.filter((api) => id == api.link.toLowerCase())[0]; 44 | const api = data.link; 45 | 46 | const backupFile = path.join(__dirname, `../api/${api}.json.backup`); 47 | const mainFile = path.join(__dirname, `../api/${api}.json`); 48 | 49 | fs.copyFile(backupFile, mainFile, (err) => { 50 | if (err) { 51 | console.log(err); 52 | } 53 | }); 54 | 55 | res.render("api-reset", { 56 | ...data, 57 | }); 58 | 59 | process.exit(1); 60 | }); 61 | 62 | module.exports = router; 63 | -------------------------------------------------------------------------------- /server/routes/testApis.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const ApiList = require("../apiList"); 3 | //const fetch = require("node-fetch"); 4 | const router = express.Router(); 5 | 6 | /// Main EndPoint Route 7 | router.get("/", (req, res) => { 8 | res.set("Content-Type", "text/html"); 9 | res.write("Testing..."); 10 | res.write("Testing all endpoints...
"); 11 | 12 | let PromiseFetches = []; 13 | ApiList.forEach((apiDeets) => { 14 | //res.write(`
Testing ${apiDeets.title}...
`); 15 | PromiseFetches.push( 16 | apiDeets.endPoints.map((endpoint) => { 17 | const url = `http://${req.headers.host}/${apiDeets.link}/${endpoint}`; 18 | 19 | try { 20 | return fetch(url) 21 | .then((res) => res.json()) 22 | .then((collection) => { 23 | //console.log(collection.length); 24 | res.write(`calling ${url}: `); 25 | if (collection && collection.length) { 26 | res.write(`${collection.length} records found
`); 27 | } else { 28 | res.write("FAIL!!!!
"); 29 | } 30 | return collection.length; 31 | }) 32 | .catch((err) => { 33 | console.log(`Error fetching ${url}`); 34 | console.error(err); 35 | 36 | res.write(`Error fetching ${url}`); 37 | res.write(err); 38 | return 0; 39 | }); 40 | } catch (err) { 41 | console.log(`Error fetching ${url}`); 42 | console.error(err); 43 | 44 | res.write(`Error fetching ${url}`); 45 | res.write(err); 46 | return new Promise((done, reject) => { 47 | done(0); 48 | }); 49 | } 50 | }), 51 | ); 52 | }); 53 | //console.log("PromiseFetches",PromiseFetches); 54 | Promise.all(PromiseFetches).then((results) => { 55 | setTimeout(() => { 56 | res.end(""); 57 | }, 1000); 58 | }); 59 | }); 60 | 61 | // API EndPoint Route 62 | 63 | module.exports = router; 64 | -------------------------------------------------------------------------------- /server/sampleapis.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const path = require("path"); 3 | const cors = require("cors"); 4 | 5 | // Express App 6 | const app = express(); 7 | const port = process.env.PORT || 5555; 8 | 9 | // JSON Parser 10 | 11 | // parse application/json 12 | app.use(express.json()); 13 | app.use(express.urlencoded({ extended: false })); 14 | 15 | // Static Files 16 | app.use(express.static(path.join(__dirname, "/public"))); 17 | 18 | // View Engine 19 | app.set("view engine", "pug"); 20 | app.set("views", path.join(__dirname, "/views")); 21 | 22 | // CORS 23 | app.use(cors()); 24 | 25 | // For debugging; 26 | // app.use(morgan('dev')); 27 | 28 | // Routes 29 | const reset = require("./routes/reset"); 30 | const baseApis = require("./routes/base-apis"); 31 | const frontend = require("./routes/frontend"); 32 | const test = require("./routes/testApis"); 33 | 34 | app.use("/frontend", frontend); 35 | 36 | const create = require("./routes/create-apis"); 37 | 38 | const { generateAPIListData } = require("./utils/getAPIListData"); 39 | const generateNewAPIListData = async (req, res) => { 40 | await generateAPIListData(); 41 | 42 | res.json({ 43 | response: 200, 44 | data: { 45 | message: "Created", 46 | }, 47 | }); 48 | }; 49 | 50 | //! Deprecation Notice 51 | //* This is to serve the old static design site. 52 | //* The `apiList.js` will be removed in future versions. 53 | const ApiList = require("./apiList"); 54 | app.get("/", (req, res) => { 55 | res.render("index", { 56 | apiList: JSON.stringify(ApiList), 57 | }); 58 | }); 59 | 60 | app.use("/resetit", reset); 61 | app.use("/create", create); 62 | // app.use("/custom", custom); 63 | app.use("/generate", generateNewAPIListData); 64 | app.use("/test",test); 65 | app.use("/", baseApis); 66 | 67 | // Starting App 68 | app.listen(port, () => { 69 | console.log(`App is listening on: http://localhost:${port}`); 70 | }); 71 | -------------------------------------------------------------------------------- /server/tests/apis.test.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const apiList = require('../apiList.js'); 4 | 5 | describe('List of APIs (apiList.js)', () => { 6 | 7 | it('is not empty', () => { 8 | expect(apiList.length).toBeGreaterThan(0); 9 | }) 10 | 11 | it('contains APIs with valid ids', () => { 12 | expect(apiList.filter( api => api.id > 0 )).toHaveLength(apiList.length); 13 | }) 14 | 15 | it('contains APIs with valid links', () => { 16 | expect(apiList.filter( api => api.link && api.link.length > 0 )).toHaveLength(apiList.length); 17 | }) 18 | 19 | it('contains APIs with valid graphql links', () => { 20 | expect(apiList.filter( api => api.graphLink === `${api.link}/graphql`)).toHaveLength(apiList.length); 21 | }) 22 | 23 | it('contains APIs with valid titles', () => { 24 | expect(apiList.filter( api => api.title && api.title.length > 0 )).toHaveLength(apiList.length); 25 | }) 26 | 27 | it('contains APIs with valid descriptions', () => { 28 | expect(apiList.filter( api => api.desc && api.desc.length > 0 )).toHaveLength(apiList.length); 29 | }) 30 | 31 | it('contains APIs with valid long descriptions', () => { 32 | expect(apiList.filter( api => api.longDesc && api.longDesc.length > 0 )).toHaveLength(apiList.length); 33 | }) 34 | 35 | it('contains APIs with at least one endpoint', () => { 36 | expect(apiList.filter( api => api.endPoints && Array.isArray(api.endPoints) && api.endPoints.length > 0 )).toHaveLength(apiList.length); 37 | }) 38 | 39 | it('have valid .json files associated', () => { 40 | expect(apiList.filter( api => { 41 | let rawData = fs.readFileSync(path.join(__dirname, `../api/${api.link}.json`)); 42 | return rawData && rawData.length > 0; 43 | })).toHaveLength(apiList.length); 44 | }) 45 | 46 | it('have valid backup .json files associated', () => { 47 | expect(apiList.filter( api => { 48 | let rawData = fs.readFileSync(path.join(__dirname, `../api/${api.link}.json.backup`)); 49 | return rawData && rawData.length > 0; 50 | })).toHaveLength(apiList.length); 51 | }) 52 | 53 | }); -------------------------------------------------------------------------------- /server/utils/getAPIListData.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | 4 | const directoryPath = path.join(__dirname, "../api"); 5 | 6 | const getAPIListData = async () => { 7 | let files = await fs.readdirSync(directoryPath); 8 | files = files.filter((f) => !f.includes(".backup")); 9 | return files.map((file) => { 10 | const data = JSON.parse(fs.readFileSync(path.join(__dirname, `../api/${file}`))); 11 | const endpoints = Object.keys(data); 12 | const metaData = data.metaData[0]; 13 | const name = file.split(".")[0].toLowerCase(); 14 | 15 | return { 16 | name, 17 | link: name, 18 | metaData, 19 | endpoints: endpoints.filter((e) => e != "metaData"), 20 | }; 21 | }); 22 | }; 23 | 24 | const generateAPIListData = async () => { 25 | let files = await fs.readdirSync(directoryPath); 26 | files = files.filter((f) => !f.includes(".backup")); 27 | const apiData = files.map((file) => { 28 | const data = JSON.parse(fs.readFileSync(path.join(__dirname, `../api/${file}`))); 29 | const endpoints = Object.keys(data); 30 | const metaData = data.metaData[0]; 31 | const name = file.split(".")[0].toLowerCase(); 32 | 33 | return { 34 | name, 35 | link: name, 36 | metaData, 37 | endpoints: endpoints.filter((e) => e != "metaData"), 38 | }; 39 | }); 40 | 41 | const jsFileData = `module.exports = ${JSON.stringify(apiData)}`; 42 | await fs.writeFileSync("./GeneratedAPIList.js", jsFileData); 43 | return true; 44 | }; 45 | 46 | module.exports = { 47 | getAPIListData, 48 | generateAPIListData, 49 | }; 50 | -------------------------------------------------------------------------------- /server/utils/rateLimiterDefaults.js: -------------------------------------------------------------------------------- 1 | const rateLimit = require("express-rate-limit"); 2 | 3 | const allowlist = ["170.55.81.98","12.220.63.124"]; 4 | 5 | const apiLimits = rateLimit({ 6 | windowMs: 15 * 60 * 1000, // 5 minutes 7 | max: 5000, 8 | message: "Too many requests, please try again after five minutes.", 9 | skip: (req, res) => allowlist.includes(req.ip), 10 | }); 11 | 12 | module.exports = { 13 | apiLimits, 14 | }; 15 | -------------------------------------------------------------------------------- /server/utils/utils.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | function getFromFile(fileName) { 4 | let rawData = fs.readFileSync(fileName); 5 | let parsedData = JSON.parse(rawData); 6 | traverse(parsedData); 7 | return parsedData; 8 | } 9 | 10 | function traverse(x) { 11 | if (isArray(x)) { 12 | traverseArray(x); 13 | } else if (typeof x === "object" && x !== null) { 14 | traverseObject(x); 15 | } 16 | } 17 | 18 | function traverseArray(arr) { 19 | arr.forEach(function (x) { 20 | traverse(x); 21 | }); 22 | } 23 | 24 | function traverseObject(obj) { 25 | for (var key in obj) { 26 | let replaced = key 27 | .trim() 28 | .replace(" ", "") 29 | .replace("-", ""); 30 | if (obj[key] && key !== replaced) { 31 | obj[replaced] = obj[key]; 32 | delete obj[key]; 33 | } 34 | if (obj.hasOwnProperty(replaced)) { 35 | traverse(obj[replaced]); 36 | } 37 | } 38 | } 39 | 40 | function isArray(o) { 41 | return Object.prototype.toString.call(o) === "[object Array]"; 42 | } 43 | 44 | module.exports = { 45 | getFromFile: getFromFile 46 | }; -------------------------------------------------------------------------------- /server/utils/verifyData.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { getFromFile } = require("./utils"); 3 | 4 | const verifyData = (req, res, next) => { 5 | const { method, originalUrl, body } = req; 6 | try { 7 | const [baseParent, endPoint] = originalUrl.split("/").filter((d) => d); 8 | const dataPath = path.join(__dirname, `../api/${baseParent}.json`); 9 | const data = getFromFile(dataPath)[endPoint][0]; 10 | 11 | const dataKeys = Object.keys(data); 12 | 13 | const expectedObjectData = {}; 14 | for (let key in data) { 15 | let type = typeof data[key]; 16 | if (type == "object") { 17 | type = Array.isArray(data[key]) ? "array" : "object"; 18 | } 19 | expectedObjectData[key] = type; 20 | } 21 | 22 | const bodyKeys = ["id", ...Object.keys(body)]; 23 | 24 | if (method == "POST" || method == "PUT") { 25 | if (!hasAllData(dataKeys, bodyKeys)) { 26 | return res.json({ 27 | error: 400, 28 | message: 29 | "The data you are sending does not match the existing data object. Check out the expected shape versus what was sent.", 30 | expected: expectedObjectData, 31 | received: body, 32 | }); 33 | } 34 | 35 | return next(); 36 | } 37 | 38 | if (method == "PATCH") { 39 | if (!hasRelativeData(dataKeys, bodyKeys)) { 40 | return res.json({ 41 | error: 400, 42 | message: 43 | "It appears you are trying to manipulate data that does not exist on the object. Check out the expected shape versus what was sent.", 44 | expected: expectedObjectData, 45 | received: body, 46 | }); 47 | } 48 | 49 | return next(); 50 | } 51 | 52 | if (method == "GET" || method == "DELETE") { 53 | return next(); 54 | } 55 | 56 | } catch (ex) { 57 | //console.log("invalid data sent in: ",body) 58 | return res.json({ 59 | error: 500, 60 | message: 61 | `Unexpected data sent in! ${method} NOT accepted. Please send valid data next time!`, 62 | received: body, 63 | }); 64 | 65 | 66 | } // end of try 67 | }; 68 | 69 | function hasAllData(dataKeys, bodyKeys) { 70 | return dataKeys.every((dataKey) => bodyKeys.includes(dataKey)); 71 | } 72 | 73 | function hasRelativeData(dataKeys, bodyKeys) { 74 | return bodyKeys.some((bodyKey) => dataKeys.includes(bodyKey)); 75 | } 76 | 77 | module.exports = { verifyData }; 78 | -------------------------------------------------------------------------------- /server/views/404-custom.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main.not-found 4 | code 5 | |{ 6 | | samplesAPI: { 7 | | error: "404 Endpoint Not Found", 8 | | message: "Browser might need a refresh." 9 | | action: "Click link to fresh #[a(href=`/custom/${id}`) #{id}] to kick the server. 10 | | } 11 | |} 12 | -------------------------------------------------------------------------------- /server/views/404.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main.not-found 4 | code 5 | | 6 | |{ 7 | | samplesAPI: { 8 | | error: "404 Page not Found" 9 | | } 10 | |} 11 | | 12 | p 13 | | Take me 14 | a(href="/") home -------------------------------------------------------------------------------- /server/views/api-reset.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main 4 | article.site 5 | .site__inner 6 | a(href="/" class="backBtn") Home 7 | h1.site__title #{title} has been reset. 8 | p Looks like everything reset ok. Navigate to any endpoint and start playing. 9 | -------------------------------------------------------------------------------- /server/views/create.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main#app 4 | article.site 5 | .site__inner 6 | h1 Create a Custom Endpoint! 7 | p Do you need a quick database to test your ideas? Look no further. 8 | p SampleAPIs.com lets you store, read & modify JSON data over HTTP APIs for free, for 10 days. 9 | P Enter you own name, or copy the one below, click the Create button, and CRUD until your hearts content. 10 | 11 | .custom-endpoint-wrapper 12 | h2 Give your endpoint a name. 13 | .form-group 14 | label(for="endpoint-name") Base Endpoint Name 15 | input.endpoint-name(type="text", id="endpoint", maxlength="50", placeholder="Custom Endpoint") 16 | br 17 | .form-group 18 | label(for="endpoint-list") List of Endpoints 19 | textarea.endpoint-list(placeholder="Separate Endpoints by ;") 20 | br 21 | button.btn.btn-primary Create Endpoint 22 | p.message 23 | section.apis 24 | 25 | script. 26 | const createBtn = document.querySelector('.btn'); 27 | const endpointNameInput = document.querySelector('.endpoint-name'); 28 | const endpointListInput = document.querySelector('.endpoint-list'); 29 | const endpointNameDisplay = document.querySelector('.custom-name'); 30 | const messageDisplay = document.querySelector('.message'); 31 | let endpointName = ''; 32 | let endpointList = [] 33 | 34 | createBtn.addEventListener('click', async (e) => { 35 | e.preventDefault(); 36 | endpointName = endpointNameInput.value.trim().toLowerCase().split(' ').join('-'); 37 | endpointList = endpointListInput.value.split(';').map(e => e.trim()).filter(e => e); 38 | console.log(endpointName); 39 | console.log(endpointList); 40 | 41 | if (!endpointName || !endpointList) { 42 | console.log('no name') 43 | messageDisplay.innerHTML = "Please fill out form."; 44 | return; 45 | } 46 | 47 | const resp = await fetch(`http://localhost:5555/create`, { 48 | method: 'POST', 49 | headers: { 50 | 'Accept': 'application/json', 51 | 'Content-Type': 'application/json' 52 | }, 53 | body: JSON.stringify({endpointName, endpoints: endpointList}) 54 | }); 55 | const data = await resp.json(); 56 | 57 | if (data.status == 201) { 58 | messageDisplay.innerHTML = `Your Endpoint was created. Go to /custom/${endpointName} to see default page.`; 59 | return; 60 | } 61 | 62 | if (data.status != 200) { 63 | messageDisplay.innerText = data.message; 64 | return; 65 | } 66 | 67 | }); 68 | -------------------------------------------------------------------------------- /server/views/custom.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main 4 | article.site 5 | .page__inner 6 | a(href="/" class="backBtn") Home 7 | h1.site__title Custom Endpoint: #{name} 8 | p.site__desc This is a temporary custom endpoint. 9 | p You can use any HTTP verbs (GET, POST, PUT, PATCH and DELETE) and access your resources from anywhere using CORS and JSONP. 10 | 11 | section.content 12 | p Here are the endpoints currently available. 13 | nav.endpoints 14 | a.endpoint(href=`/custom/${link}/graphql/` target="_blank") GraphQL 15 | each endPoint in endPoints 16 | a.endpoint(href=`/custom/${link}/api/${endPoint}` target="_blank")= endPoint 17 | p Example code 18 | .code-group 19 | button.copy Copy 20 | .copied 21 | p Copied! 22 | code(spellcheck="false") 23 | p const baseURL = 'https://sampleapis.com/custom/#{link.toLowerCase()}/api/#{endPoints[0]}'; 24 | p fetch(baseURL) 25 | p .then(resp => resp.json()) 26 | p .then(data => console.log(data)); 27 | textarea.hidden 28 | 29 | script(src="/scripts/CodeHighlight.js") 30 | script. 31 | document.querySelectorAll('.code-group').forEach(group => { 32 | new CodeHighlight(group); 33 | }); 34 | -------------------------------------------------------------------------------- /server/views/index.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main#app 4 | article.site 5 | .site__inner 6 | h1.site__title Sample APIs 7 | p 8 | | Welcome to SampleAPIs. A playground for messing with RESTful and GraphQL endpoints. Checkout the project on 9 | a(href="https://github.com/jermbo/SampleAPIs") GitHub 10 | | and consider contributing to the project with a new endpoint! 11 | p 12 | | You can use any HTTP verbs (GET, POST, PUT, PATCH and DELETE) and 13 | | access your resources from anywhere using CORS and JSONP. 14 | p.disclaimer 15 | | * The data on this site is for educational purposes only and is not 16 | | owned by SampleAPIs.com 17 | p.disclaimer 18 | | * The data on this site will be reset on a regular basis. 19 | p.example_code Example code: 20 | .code-group 21 | button.copy Copy 22 | .copied 23 | p Copied! 24 | code(spellcheck="false") 25 | p const baseURL = "https://sampleapis.com/futurama/api/characters"; 26 | p fetch(baseURL) 27 | p .then(resp => resp.json()) 28 | p .then(data => console.log(data)); 29 | textarea.hidden 30 | p.Explanation Want to Search? Then use this endpoint: 31 | .code-group 32 | button.copy Copy 33 | .copied 34 | p Copied! 35 | code(spellcheck="false") 36 | p const baseURL = "https://sampleapis.com/futurama/api/characters"; 37 | p fetch(`${baseURL}?name.first=Bender`) 38 | p .then(resp => resp.json()) 39 | p .then(data => console.log(data)); 40 | textarea.hidden 41 | 42 | section.apis 43 | apis(v-for="api, i in apis" :api="api" :key="i") 44 | 45 | 46 | template#api 47 | article.api 48 | .api__inner 49 | h2.api__title {{ api.title }} 50 | p.api__desc {{ api.desc }} 51 | a.api__link(:href="api.link") API Link 52 | a.api__link(:href="api.graphLink" target="_blank") GRAPHQL Link 53 | 54 | script(src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js") 55 | script. 56 | const api = Vue.component("Apis", { 57 | template: "#api", 58 | props: ["api"] 59 | }); 60 | const apiList = !{apiList}; 61 | 62 | const app = new Vue({ 63 | el: ".apis", 64 | data: function() { 65 | return { 66 | apis: apiList 67 | } 68 | }, 69 | components: { 70 | apis: api 71 | } 72 | }); 73 | 74 | script(src="./scripts/CodeHighlight.js") 75 | script. 76 | document.querySelectorAll(".code-group").forEach(group => { 77 | new CodeHighlight(group) 78 | }) -------------------------------------------------------------------------------- /server/views/page.pug: -------------------------------------------------------------------------------- 1 | include partials/header.pug 2 | body 3 | main 4 | article.site 5 | .page__inner 6 | a(href="/" class="backBtn") Home 7 | h1.site__title= title 8 | p.site__desc= longDesc 9 | p You can use any HTTP verbs (GET, POST, PUT, PATCH and DELETE) and access your resources from anywhere using CORS and JSONP. 10 | 11 | section.content 12 | p Here are the endpoints currently available. 13 | nav.endpoints 14 | each endPoint in endPoints 15 | a.endpoint(href=`/${link}/api/${endPoint}` target="_blank")= endPoint 16 | p Example code 17 | .code-group 18 | button.copy Copy 19 | .copied 20 | p Copied! 21 | code(spellcheck="false") 22 | p const baseURL = 'https://sampleapis.com/#{link.toLowerCase()}/api/#{endPoints[0]}'; 23 | p fetch(baseURL) 24 | p .then(resp => resp.json()) 25 | p .then(data => console.log(data)); 26 | textarea.hidden 27 | 28 | script(src="./scripts/CodeHighlight.js") 29 | script. 30 | document.querySelectorAll('.code-group').forEach(group => { 31 | new CodeHighlight(group); 32 | }); 33 | -------------------------------------------------------------------------------- /server/views/partials/header.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | head 3 | meta(charset='UTF-8') 4 | meta(name='viewport' content='width=device-width, initial-scale=1.0') 5 | meta(http-equiv='X-UA-Compatible' content='ie=edge') 6 | title Sample APIs 7 | link(rel='stylesheet' href='/assets/styles/home-styles.css') 8 | link(rel='stylesheet' href='/assets/styles/code.css') 9 | 10 | // FACEBOOK 11 | meta(property='og:title' content='Sample APIs') 12 | meta(property='og:site_name' content='Sample APIs') 13 | meta(property='og:url' content='https://sampleapis.com') 14 | meta(property='og:description' content='A playground for RESTful and GraphQL endpoints.') 15 | meta(property='og:image' content='https://sampleapis.com/assets/images/poster.jpg') 16 | meta(property='og:type' content='website') 17 | 18 | // TWITTER 19 | meta(property='twitter:card' content='A playground for RESTful and GraphQL endpoints.') 20 | meta(property='twitter:title' content='Sample APIs') 21 | meta(property='twitter:description' content='A playground for RESTful and GraphQL endpoints.') 22 | meta(property='twitter:creator' content='Jermbo') 23 | meta(property='twitter:url' content='https://sampleapis.com') 24 | meta(property='twitter:image' content='https://sampleapis.com/assets/images/poster.jpg') 25 | meta(property='twitter:image:alt' content='Sample APIs') 26 | 27 | // Global site tag (gtag.js) - Google Analytics 28 | script(async='async' src='https://www.googletagmanager.com/gtag/js?id=UA-125356349-1') 29 | script. 30 | window.dataLayer = window.dataLayer || []; 31 | function gtag() { 32 | dataLayer.push(arguments); 33 | } 34 | gtag("js", new Date()); 35 | gtag("config", "UA-125356349-1"); --------------------------------------------------------------------------------