Giter Club home page Giter Club logo

final-space-api's Introduction

final-space-api's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

final-space-api's Issues

Creatures Endpoint

new functionality that returns creatures that are part of Final Space.

Add 404 Page

After random url its not showing 404 not found page,

Bug in readme npm command

Describe the bug
The frontend contributing section of the readme states to run npm run server. However, server is not recognized an an npm script.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to '/frontend`
  2. Run npm run build
  3. Run npm run server

Expected behavior
The development server is expected to spawn on localhost:3000.

Desktop (please complete the following information):

  • OS: Linux
  • Browser N.A.

Additional context
Encountered on the CLI

Add data seeder to backend

When cloning a project locally, there is no data to start with for testing or experiment with, so it will be nice if there's a seeder to seed data to the local database.

I'm thinking of adding an npm script called seed so we will have command npm run seed to seed local database with current actual data fetched from api

so basically the npm run seed will:-

  1. connect to local database
  2. fetch data from api.
  3. seed local database.

I think the file will be named seeder.js and it will be in the root of backend folder and use Axios as dev dependency

If you like the idea assign it to me so I'll give it a shot

Add SORT param to Character endpoint

Add a sort parameter which lets the user sort the response based on id.

https://finalspaceapi.com/api/v0/character/?sort=desc
Return the response starting from 40

https://finalspaceapi.com/api/v0/character/?sort=asc
This response will be same as https://finalspaceapi.com/api/v0/character/ i.e. from 1 to 40.

So, https://finalspaceapi.com/api/v0/character/ is the same as https://finalspaceapi.com/api/v0/character/?sort=asc and they both return same response.

Resource: http://expressjs.com/en/api.html#req.query

Add Examples to the Documentation

There is only one example present right now in the documentation i.e. Live React Example which can be found here
https://finalspaceapi.com/docs/react/

Docusarus uses React Live for the interactive coder so it will only support React.

Add more example with the language and frameworks of your choice.

Resource:
https://v2.docusaurus.io/docs/markdown-features/#syntax-highlighting

https://v2.docusaurus.io/docs/markdown-features/#interactive-code-editor

P.S. it doesn't necessarily have to be a live example. You can add simple code snippets with their output too.

Here are a few ideas for this

Completed

Rest is up to your imagination.

API Response Restructure

Is your feature request related to a problem? Please describe.
Currently, all character and episode endpoints just return the character/episode json or an array of the character/episodes that match the request.

Describe the solution you'd like
I think that all correct responses should have one of the following formats:

{
  "status": 200,
  "data": {}
}

or

{
  "status": 200,
  "results": [],
}

Of course, the response status should match the correct status of the response. If we changed to doing this, though, then it would allow us to include errors in incorrect responses that doesn't look weird. For example, if I were getting data from a certain character, but I sent the request to /character/9999, we only get a 502 Bad Gateway message. We should, however, return the following data:

{
  "status": 404,
  "message": "The character you have requested was not found."
}

Edit: the message property could be swapped for error.

Using statuses instead of errors allows an easier debugging process, as the developer can access the message and status that the servers sent.

I will work on a PR if this is deemed as needed by the community.

Quotes Endpoint

What is this ./endpoint about ?
Final Space has some great fun quotes by its characters.
This endpoint will be sending quotes.

Maybe after initial setup add a filter that will send quotes from a specific character.

What is the schema ?

quote : 'Quote',
by : 'Name of character',
character : 'URL to that character endpoint',
image: 'URL to Character Image'

Contribute data to Episode endpoint

Reopened to include Season 3 Episodes

The /episode endpoint is currently in progress.
Contribute data for individual episodes of Final Space in the given schema.

Resource: https://final-space.fandom.com/wiki/Final_Space_Wiki

P.S. You can leave the field for img_url.

You can send a PR with the data in JSON format to the endpoint branch under episode folder.

Here is the schema for /episode endpoint:

Key Type Description
id int The id of the episode.
name string The name of the episode.
air_date array The air dates of the episode.
director string Director of the episode.
writer string Writer of the episode.
characters array List of characters who have been seen in the episode.
img_url string (url) Image from the episode.
  • Indicates that the data exists for that episode.

Here is the complete list of episodes we need data for

  • Chaper 1

  • Chaper 2

  • Chaper 3

  • Chaper 4

  • Chaper 5

  • Chaper 6

  • Chaper 7

  • Chaper 8

  • Chaper 9

  • Chaper 10

  • The Toro Regatta

  • The Happy Place

  • The Grand Surrender

  • The Other Side

  • The Notorious Mrs. Goodspeed

  • The Arachnitects

  • The First Times They Met

  • The Remembered

  • The Closer You Get

  • The Lost Spy

  • The Set Up

  • The Descent Into Darkness

  • The Sixth Key

Add Prettier and Husky to frontend

@JuanVqz Did a great job adding husky and prettier to backend to format code when commiting.
See #112

   "husky": {
        "hooks": {
            "pre-commit": "lint-staged"
        }
    },
    "lint-staged": {
        "*.js": "eslint --cache --fix",
        "*.{js,css,md}": "prettier --write"
    }

Add same thing to frontend folder.

Contribute data to Character endpoint (40 characters exists)

The /character endpoint currently has 25 40 characters. (Update #25 )

There are still few characters that we can add to this endpoint.

Contribute data for individual characters of Final Space in the given schema.

Resource: https://final-space.fandom.com/wiki/Category:Characters

P.S. You can leave the field for img_url.

You can send a PR with the data in JSON format to the endpoint branch under character folder.

Please check if the data for that character exists.

Here is the schema for /character endpoint:

Key Type Description
id int The id of the character (starting from 1).
name string The name of the character.
status string The status of the character.
species string The species of the character.
gender string The gender of the character.
hair string The hair color of the character.
origin object Name of the character's origin location.
abilities array Different abilities of character.
alias array Different names of character.
img_url string (url) Link to the character's image.

API Endpoint Creation optimization

Is your feature request related to a problem? Please describe.
We should make it so that api endpoints/urls are not repeated in the back-end code at all. All of the endpoints should be pulled from an endpoints file that gives you all of the data to handle the requests.

Describe the solution you'd like
I already created an endpoints.js in a PR, all we have to do is include this within the api endpoint files.

Make the main README more informative and nice-looking

Is your feature request related to a problem? Please describe.
The README lacks some important features related to contribution for beginners and some other features need to be added.

Describe the solution you'd like
Adding badges and writing a clear and concise guideline for contribution

Additional context
I would be adding some badges to give it a modern look and some other edits

Add Docusarus Image Plugin and configure the images

Docusarus provides ideal image plugin. This plugin will optimize images in the production build.

https://v2.docusaurus.io/docs/using-plugins#docusaurusplugin-ideal-image

Add this plugin and update the images in the frontend folder, specifically the images on the landing page

Here is the permalink for the code that needs to be updated

src={useBaseUrl(`img/${props.charName}.webp`)}

Add NodeJS CI Workflow

Relies on #2 i.e. after Tests have been written.

Here is a possible

name: Node.js CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [8.x, 10.x, 12.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install
    - run: npm run build --if-present
    - run: npm test
      env:
        CI: true

Add Introduction to the Docs

Currently the introduction to the API is very small.

https://finalspaceapi.com/docs/

This is a documentation issue, write a good introduction ot the API.

Word Limit - 250 to 300 words. This is just a suggestion, even if you end up writing 500 words, just send the PR we will work something out.

Migrate Images to Cloudinary

Is your feature request related to a problem? Please describe.
Currently the images are stored in the local directory and are sent from the same.

Describe the solution you'd like
Migrate all the images to Cloudinary.

With Cloudinary, users will be able to resize, crop and transform images as per their app requirements.

Serve images in next-gen formats - (WebP)

Image formats like JPEG 2000, JPEG XR, and WebP often provide better compression than PNG or JPEG, which means faster downloads and less data consumption.

Change the format of the following images to WebP.
(Note: this is only for the images under frontend/static/img which are displayed on the landing page.)

  • Indicates that WebP format exists for that image.

  • gary_goodspeed.jpg

  • avocato.jpg

  • kvn.jpg

  • mooncake.jpg

  • little_cato.jpg

  • quinn_ergon.jpg

  • ash_graven.jpg

Contribute data to Location Endpoint

Reopened to include Season 3 locations

The /location endpoint is currently in progress.

You can contribute data for locations in Final Space in the given schema.

Resource: https://final-space.fandom.com/wiki/Category:Location

P.S. You can leave the field for img_url.

You can send a PR with the data in JSON format to the endpoint branch under location folder.

Here is the schema for /location endpoint:

Key Type Description
id int The id of the location.(Starts with 1)
name string The name of the location.
type array Type of location.
inhabitants string Inhabitants of the location.
notable_residents array Notable residents(if any).
img_url string (url) Image of the location.

(leave fields with no information as Unknown or just empty.)

P.S.: The information about locations is less, so 5-10 main locations data is enough.

This may include but not limited to the following location.

  • Indicates that the data exists for that episode.

  • Earth

  • Final Space

  • Tera Con Prime

  • Inner Space

  • Yarno

  • Dark Zone

  • Deathcropolis

  • Lazarus Trap

  • The Order of the Twelve

Create a logo for this API

Currently, this image is used as logo and favicon.

Create a new logo for this API

I would suggest becoming familiar with Final Space will be beneficial.
Even Mooncake can be used as a logo.

It's upto your imagination.

All Endpoints Except `/` are Broken on Development

Describe the bug
I just followed all steps mentioned in the README for running the backend in development. After running npm run serve in the backend directory, though, localhost:8000 is not returning any data when sending a request to http://localhost:8000/api/v0/character or any of the other endpoints besides http://localhost:8000/api/v0/.

To Reproduce
Steps to reproduce the behavior:

  1. gh repo clone lelouchB/final-space-api
  2. cd final-space-api
  3. cd backend
  4. npm install
  5. npm run dev
  6. go to http://localhost:8000/api/v0/character

Expected behavior
The server should be returning the actual data

Screenshots
image
image
image

Desktop:

  • OS: Windows
  • Browser Chrome
  • Version 85

Update character images to be consistent (300x300)

Currently the character images in ./backend/images folder are of different sizes.

Generate new images 300x300px jpg format.

  • Indicates that the 300x300px image exists for that character.

Here is the complete list of characters we need images for

  • Gary Goodspeed
  • Mooncake
  • Quinn Ergon
  • Little Cato
  • Avocato
  • KVN
  • Ash Graven
  • Fox
  • H.U.E
  • Clarence
  • Lord Commander
  • Nightfall
  • A.V.A
  • Tribore
  • John Goodspeed
  • Sheryl Goodspeed
  • Gary Goodspeed (Nightfall's timeline)
  • Bolo
  • Invictus
  • Melanie Dewinter
  • Harp Graven
  • Shannon Thunder
  • Chuck
  • Septim
  • Fraskenhaur

Create README.md for backend folder

Create a basic README.md file for the backend server.

The README should include but not limited to

  • Getting Started
  • Project Structure
  • How to Install?
  • Run Development Server
  • Tech Stack (list of dependencies)

Add status icon to Character endpoint

If we can send a character status icon, for example a green filled circle for a character that is alive.

It will save a lot of time for devs who are trying to show status using colored icons.

For example
image

For this we will have to create an icons (preferrably 50x50) jpeg. We only need three icons

  • Alive - Green Filled Circle
  • Dead/ Deceased - Red Filled Circle
  • Operational - Yellow Filled Circle

You can use any icon from web (free icon), or create one in paint.
Just head over to paint and resize the area to 50x50px and create a circle, then fill it with proper color. Should be done in a few times..

Let me know if you have any question

Refactor index.js:Home

I've selected index.js:Home for refactoring, which is a unit of 146 lines of code. Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Short Units of Code guideline rating! ๐Ÿ‘

Here's the gist of this guideline:

  • Definition ๐Ÿ“–
    Limit the length of code units to 15 lines of code.
  • Whyโ“
    Small units are easier to analyse, test and reuse.
  • How ๐Ÿ”ง
    When writing new units, don't let them grow above 15 lines of code. When a unit grows beyond this, split it in smaller units of no longer than 15 lines.

You can find more info about this guideline in Building Maintainable Software. ๐Ÿ“–


โ„น๏ธ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the ๐Ÿ”ฒ next to them. The risk profile below the candidates signals (โœ…) when it's enough! ๐Ÿ


Good luck and happy coding! :shipit: โœจ ๐Ÿ’ฏ

Create route for Quotes Endpoint

#140
To Do

  • Create quote.model.js under backend/models
  • Create quote.api.js in backend/controllers directory
  • Add quotes to routes/routes.js
  • Add quote to config/endpoints.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.