Giter Site home page Giter Site logo

sinatra-dynamic-routes-lab-onl01-seng-ft-070620's Introduction

Sinatra Dynamic Routes Lab

Overview

This lab will serve to reinforce your understanding of routes in a Sinatra application. Complete the following tasks in your application controller and get all of the tests to pass.

Spacing in URLs

In some of the tests you might notice %20 between words in a URL. URLs are not allowed to have spaces in them. Something like this www.facebook.com/flatiron school would never work as a website name. The % sign in a URL is called URL encoding. Basically, it replaces characters that are unsafe for a URL with appropriate ASCII characters.

You can take a look at this list for a reference on unsafe url characters, and how to use url encoding to correct them.

Instructions

  1. Create a dynamic route at get '/reversename/:name' that accepts a name and renders the name backwards.

  2. Create a dynamic route at get '/square/:number' that accepts a number and returns the square of that number. Note: Remember that values in params always come in as strings, and your return value for the route should also be a string (use .to_i and .to_s).

  3. Create a dynamic route at get '/say/:number/:phrase' that accepts a number and a phrase and returns that phrase in a single string the number of times given.

  4. Create a dynamic route at get '/say/:word1/:word2/:word3/:word4/:word5' that accepts five words and returns a string containing all five words (i.e. word1 word2 word3 word4 word5).

  5. Create a dynamic route at get '/:operation/:number1/:number2' that accepts an operation (add, subtract, multiply or divide) and performs the operation on the two numbers provided, returning a String. For example, going to /add/1/2 should render 3 as a String.

sinatra-dynamic-routes-lab-onl01-seng-ft-070620's People

Contributors

lizbur10 avatar dependabot[bot] avatar dfenjves avatar gj avatar annjohn avatar pletcher avatar ipc103 avatar curiositypaths avatar maxwellbenton avatar jmburges avatar imkaruna avatar rrcobb avatar sandyvern avatar sgharms avatar timothylevi avatar ruchiramani avatar victhevenot avatar

Watchers

James Cloos avatar Kaitlin Vignali avatar Mohawk Greene avatar  avatar Otha avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar  avatar Ben Oren avatar Matt avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Ahmed avatar Nicole Kroese  avatar Dominique De León avatar  avatar Lisa Jiang avatar Vicki Aubin 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.