Giter Site home page Giter Site logo

sinatra-dynamic-routes-lab-onl01-seng-pt-052620'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 learn 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-pt-052620's People

Contributors

angelastephens avatar annjohn avatar curiositypaths avatar dependabot[bot] avatar dfenjves avatar gj avatar imkaruna avatar ipc103 avatar jmburges avatar lizbur10 avatar maxwellbenton avatar pletcher avatar rrcobb avatar ruchiramani avatar sandyvern avatar sgharms avatar victhevenot 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.