Giter VIP home page Giter VIP logo

socialplaylist-server's Introduction

Live List Server

It is a collaboration between Daniel Lee Bright, Glaiza Wagner, Wesley Jacobs, Julio Hernandez, and Lazandrea Celestine.

Technology Used

  • Node | Express | PostgreSQL | GeoCode | Bcryptjs | JWT | Morgan | Chai | Supertest
  • Deployed in Heroku

API Endpoints

The following are the request endpoints for this server:

  • Auth Endpoints

    • POST api/auth/token => It is a request handler for user login to receive a JWT. It verifies credentials for login.
    • PUT api/auth/token => It is a request handler for user login that allows automatic refreshing of token.
  • User Endpoints

    • POST /api/user => It is a request handler for user registration/sign-up.
  • Spot Endpoints

    • GET /api/spots/:spot_id => It returns the details from a specific spot.
      Request:
        url param id = 134;
      Response:
        {
            id: 134,
            spot_name: 'name',
            tags: '#cheapfood #goodviews',
            address: '132 somewhere st.',
            city: 'Orlando',
            state: 'FL',
            lat: 54.312937,
            lng: 12.319744
        }
    
    • POST /api/spots => It will add a spot to a list. It will insert a new record in the spots table as well as in the lists_spots table.
      Request:
    {
        "list_id": 2,
        "name": "name",
        "tags": "#cheapfood #goodviews",
        "address": "132 somewhere st.",
        "city": "Orlando",
        "state": "FL"
    }
    

    Response:
    spots table

    {
        id: 134,
        spot_name: 'name',
        tags: '#cheapfood #goodviews',
        address: '132 somewhere st.',
        city: 'Orlando',
        state: 'FL',
        lat: 54.312937,
        lng: 12.319744
    }
    

    lists_spots table

    {
        list_id: 2,
        spot_id: 134
    }
    
    
    • DELETE /api/spots/:id => It will delete a record from the spots table. The request needs the req.params.id.
    • PATCH /api/spots/:id => It will update the record in the spots table.
      Request:
    {
        "name": "Giggles Night Club updated",
        "tags": "#nightout",
        "address": "215 N Brand Blvd",
        "city": "CA",
        "state": "Los Angeles",
        "list_id": 1
    }
    

    Response:

     {
        "id": 1,
        "name": "Giggles Night Club updated",
        "tags": "#nightout",
        "address": "215 N Brand Blvd",
        "city": "CA",
        "state": "Los Angeles",
        "lat": "34.083824",
        "lon": "-118.344266"
    }
    
  • List Endpoints

    • GET /api/lists => It returns all lists that are public.
      Response:
        [
            {
                "likes": "10",
                "liked_by_user": "1",
                "on_fire": "1",
                "id": 1,
                "name": "Date night",
                "tags": "#datenight",
                "city": "Los Angeles",
                "state": "CA",
                "is_public": true,
                "description": "something"
            },
            ... all other lists that match query
        ]
      
    • GET /api/lists/user => It returns all lists from currently logged-in user.
      Response:
        [
            {
                "users_id": 1,
                "list_id": 3,
                "id": 3,
                "name": "My secret list",
                "tags": "#private",
                "city": "San Diego",
                "state": "CA",
                "is_public": false
            },
            ... more lists
        ]
    
    • GET /api/user/lists/:list_id => It will return the list and spots for that list;
      Request:
        url param id;
      Response:
        {  
            list_name: 'list name',
            list_id: 1,
            tags: '#sick #cheap',
            created_by: 'username',
            description: 'stuff in here',
            liked: 10,
            tried: 100,
            spots: [
                {
                id: 1,
                name: 'spots name',
                tags: '#bestdrinks #goodmusic',
                address: '361 fake st.',
                city: 'city name',
                state: 'ST',
                lat: 12.091823,
                lng: 31.31525
                },
                ... more objects of spots
            ]
    }
    
    • GET /api/lists/city/:city_name => It returns all lists that are public, and from each city.
      Response:
      [
          {
              "likes": "10",
              "liked_by_user": "1",
              "on_fire": "1",
              "id": 1,
              "name": "Date night",
              "tags": "#datenight",
              "city": "Los Angeles",
              "state": "CA",
              "is_public": true,
              "description": "something"
          },
          ... all other lists that match query
      ]
      
    • POST /api/lists
      => It inserts a list in the lists table as well as the users_lists table.
      Request:
       {
           "name": "new list",
           "tags": "#hot #cheap #datenight",
           "city": "new_york",
           "state": "NY",
           "description": "stuff in here",
           "is_public": true
       }
      
      Response:
      lists table
       {
           list_id: 122,
           name: 'new list',
           tags: '#hot #cheap #datenight',
           city: 'new_york',
           state: 'NY',
           description: "stuff in here",
           is_public: true
       }
      
      users_lists table
        {
            users_id: 3,
            list_id: 122
        }
      
    • POST /api/lists/like/:list_id => It will toggle favorites for that list.
      Response:
      {
          "like": "1"
      }
          OR
      {
          "like": "0"
      }
      
    • DELETE /api/lists/:list_id => It will delete a list from the lists table by list_id.
    • PATCH /api/lists/:list_id => It will update the lists table by list_id.
      Request:
        {
            "name": "new list",
            "tags": "#hot #cheap #datenight",
            "city": "new city",
            "state": "NY",
            "description": "new stuff",
            "is_public": true
        }
    

    Response:

        {
            "id": 5,
            "name": "new list",
            "tags": "#hot #cheap #datenight",
            "city": "new city",
            "state": "NY",
            "is_public": true,
            "description": "new stuff"
        }
    

Copyright © 2020

socialplaylist-server's People

Contributors

brahyt avatar glaizawagner avatar julio-hernand3z avatar

Watchers

 avatar Andrea Cardy Bailey avatar James Cloos avatar Tauhida Parveen 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.