GithubHelp home page GithubHelp logo

fantasy-futbol_server's Introduction

Fantasy Futbol

Getting Started

  • Clone down this repo
  • Ensure PostGres is installed and running

In the Terminal

  • Installing packages

      $ npm install
    
  • Starting Server

      $ node server.js
    
  • Creating the Databases on Postgress

      $ psql;
      $ CREATE DATABASE soccor;
      $ CREATE DATABASE soccor-test
      $ \q
    
  • Migrating and seeding

      $ knex migrate:latest
    
      $ knex seed:run
    
  • Running Testing suite

      $ npm test
    

Endpoints

GET: /api/v1/countries (Get all Countries)

- Parameters: none
- Response: array of country objects

GET: /api/v1/players (Get all players)

- Parameters: none
- Response: 
    code 200: Array of player objects
    code 4xx, 5xx: error message

GET: /api/v1/players/:id (Get player by id)

- Request Parameters: player_id
- Response: 
    code 200: Array of the player object
    code 4xx, 5xx: error message

GET: `/api/v1/country/:id/players (Get all players by country id)

- Request Parameters: country_id
- Response: 
    code 200: Array of Player objects associated with the country_id
    code 4xx, 5xx: error message

GET: /api/v1/users (Get all users)

- Parameters: None
- Response: 
    code 200: Array of user objects
    code 4xx, 5xx: error message

GET: /api/v1/users/:id (Get user info by id)

- Request Parameters: 
    user id: [user_id]
- Response: 
    code 200: array of the user object
    code 4xx, 5xx: error message

POST: /api/v1/users (Add a new user)

- Parameters:
    username: [username of user]
    password: [password of user]
- Response: 
    code 201: username created message
    code 422: error message

POST: /api/v1/countries (Add a new country)

- Parameters: 
    country: [country name]
    flag: [image url of country flag]
- Response: 
    code 201: country created message
    code 422: error message 

PUT: /api/v1/users/:id/:player/players/:player_id (replace a player to users team)

- Request Parameters: 
    user id: [user_id]
    team player number: [column number of player]
    player id: [player_id]
- Response:
    code 201: player created message 
    code 422: error message 

PUT: /api/v1/users/:id/ (edit a users info)

- Request Parameters: 
    user id: [user_id]
- Body Parameters: 
    username: [new username]
    password: [new password]   
- Response:
    code 201: updated user info message
    code 422: error message 

DELETE: /api/v1/users/:id (delete a user)

- Request Parameters:
    user id: [user_id]
- Response:
	code 201: deleted user info message
    code 422: error message

fantasy-futbol_server's People

Contributors

benjaminpaige avatar sojurner avatar tomkingkong avatar

Watchers

James Cloos 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.