Giter VIP home page Giter VIP logo

briefpal-api's Introduction

Name: briefPal server

Server url: https://nameless-peak-53265.herokuapp.com

App url: https://briefpal-client.now.sh/userpage

github repo: https://github.com/rbannal86/briefpal-api

API documentation: Endpoints: /api/auth: /login: { user_name, password } POST returns { "authToken":"authtoken-string" }

/api/letters:
  /newletter: { user_id, content } POST
    returns id (recipient)
  /getletters/:letter_id: {} GET
    returns { id: id, content: "content", sender: id, recipient: id}

/api/register:
  /: { user_name, password } POST
    returns JWT

/api/conversations:
  /:conversation_id {} GET
    returns { id: id, user_one: id, user_two: id, letter_one: id, letter_two: id, letter_three: id, letter_count: num }
  /:conversation_id/reply { user_id, content } POST
    returns { id: id, user_one: id, user_two: id, letter_one: id, letter_two: id, letter_three: id, letter_count: num }
  /:conversation_id/:letter_id {} GET
    returns { id: id, content: "content", sender: id, recipient: id }

/api/users:
  /:user_name {} GET
    returns { id: id }
  /:user_name/conversations {} GET
    returns { conversations: [id...] }

Summary: This is the api for the briefPal app. It connects to the briefpal database which has three tables: briefpal_users, briefpal_letters, and briefpal_conversations. The users table saves a user name and a bcrypt'd password and assigns an id when created. The letter database manages individual letters, saving the content, the sender, the recipient, and an automatically assigned id. The sender and the recipient refer to the id of users in the user table. The conversation table has columns for two user id's (user_one and user_two), three letter id's (letter_one, letter_two, letter_three) and a letter_count column. The user id's and letter id's refer back to the user table and the letter table, respectively. When posting a new letter that is not attached to conversation (the first letter in a conversation), the endpoint will randomly assign the recipient value in the new letter data to an existing user_id. If that user_id is the same id as the sender, it will search again until an appropriate user is found.

Tech Stack: JS, PostgreSQL, Express, Knex

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.