Giter Club home page Giter Club logo

pokedex's Introduction

Pokedex

This is your opportunity to make your own Pokemon API and create a dyanmic and interactive front-end for it.

You can see a live demo of what we're building at bitmaker-pokedex.herokuapp.com.

Provided in this code is a seed file that will populate your database with 100 Pokemon objects. That's the only model in this app. Each Pokemon character has an image_url and some properties, like name, attack, defense, etc. Check the schema.rb for all of the fields.

Setup

  1. Fork this repo
  2. Run bundle install
  3. Run rake db:setup (this should create the database, load the schema and initialize with seed data)

Assignment

Your job is to create a JSON API for the Pokedex. You should only be concerned with the read actions to start (i.e. index and show).

  1. Setup your controller so that it returns normal HTML responses for index and show.
  2. Modify your actions to also return JSON responses for the requested Pokemon (you'll need to use respond_to for this). Return the full objects for now, don't try to limit the fields returned
  1. Limit the data returned for each Pokemon object returned from the index action to just the name and the image_url
  • You can do this within the controller by defining your own Hash
  • Again, make sure this is working by checking http://localhost:3000/pokemons.json
  • Stretch > Figure out how to use jbuilder to move this logic into a view and still get the correct output
  1. Add the Handlebars JS library to your project
  • You can add it by downloading it and putting it in /vendor/assets/javascripts and adding it to your application.js
  • You can add a javascript_include_tag to your application.html.erb and use the CDN version
  1. Create two templates for displaying your Pokemon, one for the list and one for the full details
  • You'll probably want to add these templates to your index.html.erb
  • Follow the instructions on the Handlebars homepage for creating a template (they'll be in <script> tags with id and type attributes)
  1. Add an event handler so when you click on the name of a Pokemon, the details are dynamically updated in a <div> reserved for them

Stretch Assignments

  • Look into precompiling your Handlebars templates using the handlebars_assets gem
  • Figure out a way to add new Pokemon cards to your database using pokegem
    • Double Stretch! Make it so new Pokemon get added via AJAX!

pokedex's People

Contributors

samunt avatar

Watchers

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