Giter Site home page Giter Site logo

player-api's Introduction

player-api

code challenge solution

Haven't used postgres that much so I decided to learn something new with postgres

  1. clone repo and cd into player-api
git clone https://github.com/dasqueel/player-api.git
cd player-api
  1. install postgresql (if havent)

homebrew

brew install postgresql

linux

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
  1. create a postgres database named "players"

for mac it should be simply typing in:

createdb players

for ubuntu you have to set up a password for the default "postgres" user

sudo -u postgres psql postgres

while in psql term, type and hit enter

\password postgres

type in new password and quit postgres term

\q

now have to update postgres con objects attributes in api.rb and api_to_postgre.rb
change user from nil to posgres and password from nil to your password you just typed
con line ~14 in api.rb
con line ~17 in api_to_postgres.rb
(would user config file so you only have to change once, will figure that out later)

something like this

con = PG.connect :dbname => "players", :user => "postgres", :password => "<password>"
  1. install bundler (if havent already)
gem install bundler
  1. install gems
bundle install
  1. normalize cbs play api to postgres table
ruby api_to_postrgres.rb
  1. start sinatra app
ruby app.rb
  1. you should be good to go, try sample queries

http://localhost:4567/sports/football?position=qb&age=27

or

http://localhost:4567/sports/basketball?position=c

player-api's People

Contributors

dasqueel 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.