You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kristyn Bryan bc4bcac7a6
views homework
10 years ago
..
Pokeman_Starter views homework 10 years ago
.gitkeep setup 10 years ago
README.md Update README.md 10 years ago

README.md

ga

WDI-PANTHALASSA


Title: Homework w05d02
Type: Homework
Duration: "4:00"
Creator:
Original creators: WDI-Skywalker
Adapted by: Thom Page & Kristyn Bryan
Course: WDIr Panthalassa
Competencies: Javascript, Express, Routes, Views, Node
Prerequisites: Javascript


#EXPRESS YOURSELF!!

Learning Objectives

  • Practice setting up express applications.
  • Practice creating custom routes.
  • Practice using parameters from a request.

####Tonight you will be using your new found skills to create three separate Express apps.


#Tip Calculator APP - Create an express application (see the bottom of this homework for a reminder). - Your app should have a route of `'/tip'` and it should expect *2 params*. One should be `total` and one should be `tipPercentage`. - When hitting the route, the page should *display how much your tip will be* based on the total ammount of the bill and the tip percentage. (ex. hitting `'/tip/100/20'` should display `20` on the page).

Commit 1


"Commit 1: Tip Calculator express application created."

#Magic 8 Ball APP - Create an express application. - Create a route of `'/magic'` that should expect a phrase in the URL that ask the Magic 8 ball a question. - So if the user hits that route and asks a question of "Will I be a Millionaire" (ex. `'/magic/Will%20I%20Be%20A%20Millionaire'`) he should have return to him his question AND a random Magic 8 ball response (see the array below) on the screen. - Remember that we can't use spaces in the url, so we use `%20` to express a space in the url. - So if the user hits that route and asks a question of "Will I be a Millionaire" he should get his question asked and a random Magic 8 ball quote on the screen. - Use this array of Magic 8 ball responses.....
["It is certain", "It is decidedly so", "Without a doubt", "Yes definitely","You may rely on it", "As I see it yes", "Most likely", "Outlook good","Yes", "Signs point to yes", "Reply hazy try again", "Ask again later","Better not tell you now", "Cannot predict now", "Concentrate and ask again","Don't count on it", "My reply is no", "My sources say no","Outlook not so good", "Very doubtful"]

Commit 2


"Commit 2: Magic 8 Ball express application created."

Reminder on how to set up an express application

  • Create a Javascript file (.js) for each express application (ex: tip_calculator.js).
  • Inside your homework folder, install express npm install --save express
  • Check your files. Hint: ls. If you have a node_modules folder with express somewhere inside, then you've successfully added express to your folder.
  • Inside your Javascript file,
app.get('/greeting/:name', function(req, res) {
  res.send({params: req.params, queries: req.query})
});

## Views Index Show Module.export