GithubHelp home page GithubHelp logo

javila35 / news-flash-backend Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 97 KB

Backend for news aggregator site

Home Page: https://news-flash-50a6e.web.app/

License: GNU General Public License v3.0

Ruby 100.00%

news-flash-backend's Introduction

News-Flash-Backend

Backend for a news aggregator site project by Joe Avila.

This database provides endpoints and stores information for authentication, users, user comments, and bookmarks.

TODO:

  • Handle case sensitivity for account creation
  • Handle case sensitivity for auth creation

Endpoints

Auth

  • Create: POST /auth
    • Creates a new authenticated session.
    • Params
      • username: string
      • password: string
    • Returns json user & token
    {
        user: {
            # User's unique ID
            id: number
            # User's unique username
            username: string
            # User provided first name (optional)
            first_name: string
            # User provided bio (optional)
            bio: string
            # User provided location (optional)
            location: string
        },
        jwt: JWT encoded token
    }

Bookmarks

  • Create: POST /bookmarks
    • Creates a new user bookmark
    • Params
      • user_id: number # User to associate created
      • title: string: # Title / Headline for the article
      • link: string: # Link to the article for anchor href attribute
      • img_url: string: # Link to image for img src attribute
    • Returns json bookmark
    {
        # Link to image for img src attribute
        article_img: string
        # Title / Headline for the article
        article_title: string
        # Link to the article for anchor href attribute
        article_link: string
    }
  • Show: GET /bookmarks/:id
    • Retrieve a bookmark and it's comments
    • Params
      • id: number
    • Returns serialized json bookmark and comments*
    {
        # Bookmark id
        id: number
        attributes: {
            # Link for article image
            article_img: string
            # Link for published article
            article_link: string
            # Headline of article
            article_title: string
            # Array of comment objects
            comments: Comment[]
        }

    Comment = {
        # Comment record id
        id: number
        # User the comment belongs to
        user_id: number
        # Bookmark the comment belongs to
        bookmark_id: number
        # Text to display
        comment_text: string
    }
    }

Comments

  • Create: POST /comments
    • Creates a comment on a bookmark
    • Params
      • user_id: number
      • bookmark_id: number
      • comment_text: string
    • Returns json comment and replies(?)
    {
        # Comment id
        id: number
        # User the comment belongs to
        user_id: number
        # Bookmark the comment belongs to
        bookmark_id: number
        # Text to display
        comment_text: string
    }

Users

  • Create: POST /users
    • Creates a new user
    • Params
      • username: string
      • password: string
    • Returns a json user & jwt token
    {
        user: {
            # User's unique id
            id: number
            # User's unique username
            username: string
            # Optional user provided name
            first_name: string
            # Optional user provided location
            location: string
        }
        jwt: JWT encoded token
    }
  • Destroy: DELETE /users/:id
    • Deletes a user record
    • Params
      • id: number
    • Returns json status
    status: string
  • Index: GET /users
    • Returns a username for each user record
    string[]
  • Show: GET /users/:username
    • Retrieve an individual user
    • Params
      • username: string
    • Returns user record and serialized bookmarks and comments
    {
        data: {
            id: number,
            type: "user",
            attributes: {
                username: string
                first_name: string
                location: string
                bio: string
                bookmarks: Bookmark # See Bookmark endpoint for typing
            }
        }
    }
  • Update: PATCH /users/:id
    • Edit a user record
    • Params
      • id: number
      • User Property to update. Examples: username: string, bio: string, etc
    • Returns updated json user
{
    username: string
    id: number
    first_name: string
    bio: string
    location: string
}

news-flash-backend's People

Contributors

javila35 avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

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.