Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished intro to express response lab #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// DEPENDENCIES
const express = require("express");

// CONFIGURATION
const app = express();
// const PORT = 3003;

const magic8Responses = [
"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, and 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",
];

// ROUTES
app.get("/", (req, res) => {
res.send("Hello, world");
});

app.get("/tim-gun", (req, res) => {
res.send("Make it work");
});

app.get("/emeril", (req, res) => {
res.send("Bam!");
});

app.get("/steve-mcGarrett", (req, res) => {
res.send("Book 'em Danno!");
});

app.get("/coach-taylor", (req, res) => {
res.send(" Clear eyes, full hearts, can't Lose");
});

app.get("/homer-simpson", (req, res) => {
res.send("D'Oh");
});

app.get("/bruce-banner", (req, res) => {
res.send("Don't make me angry");
});

app.get("/jj-evans", (req, res) => {
res.send("Dy-no-myte!");
});

app.get("/batman", (req, res) => {
res.send("To the Batmobile!");
});

app.get("/hannibal-smith", (req, res) => {
res.send("I love it when a plan comes together");
});

app.get("/fraiser", (req, res) => {
res.send("I'm listening");
});

app.get("/terminator", (req, res) => {
res.send(`I'll be back', 'Hasta la vista, baby`);
});

app.get("/magic8", (req, res) => {
let num = Math.ceil(Math.random() * 8)
res.send(`<h1>${magic8Responses[num]}</h1>`);
});



// EXPORT
module.exports = app;
Loading