Giter Site home page Giter Site logo

cake_api's Introduction

Rails Cake API

Objectives

  1. Practice building RESTful API.
  2. Practice full CRUD.
  3. Create RESTful routes.
  4. Understand HTTP verbs.
  5. Apply the request and response cycle.
  6. Be able to use byebug.

Instructions

Great news! You just got hired to make cakes. Lucky for you, Rails does all the work. The only challenge is, you need to know how to navigate it.

Fork and clone this lab to get started. Run bundle. Code away!

Part 1: Setting up the database

We need a few standard cakes for anyone to purchase. Add a cakes table to the database, where every cake has a flavor (string) and a price (float). Now put 3 cakes in the database. Use your rails console to ensure the cakes were made correctly.

Part 2: Building routes, actions, and models

Our customers need to know what cakes we have. They also need to be able to order new cakes. Plus, we need to be able to change information about existing cakes, and remove a cake if it's no longer being made. To do that, we'll need a route for each action. We'll also need a controller to place our actions. Code so each action runs the way we want it too. Finally, a model to represent our cake -connected to our database. You will need 5 actions to handle all these requests:

Debugging and Testing Rails

  • You will need Postman or the like to test all your requests. If you don't test your requests and responses, then you haven't completed the assessment.
  • Use byebug wherever you need to pause the code, and go to the terminal where your rails server is running. (Works just like binding.pry)
  • rails c is an environment (similar to irb) where you can test any code that you can write in your API. Play around with it.
  • rails routes will help you determine and understand which routes you have.

cake_api's People

Contributors

limittoinfinity avatar ghughes610 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.