Illuminatiiiiii
10/6/2018 - 9:14 PM

External Files & Partials

<% include partials/header %>

<h1>Welcome to the Illuminati Productions website</h1>
<p>I hope you enjoy your stay ;)</p>

<% include partials/footer %>
<% include partials/header %>

    <h1>This is all of the games we have:</h1>

    <% for(var i = 0;i < gamesList.length; i++){ %>
        <div style="border-style: solid; padding: 5px; margin: 50px; max-width: 200px">
            <h4 style="color: blue">Game: <%= gamesList[i].title %></h4>
            <h5 style="color: red">Game Creator: <%= gamesList[i].creator %></h5>
        </div>
    <% } %>



<% include partials/footer %>
<% include partials/header %>

        <h2>Game Title: <%= title %></h2>
        <h3>Game Creator: <%= creator %></h3>
        <% if(title == "Fortnite"){ %> 
            <p>Description: Fortnite Battle Royale is the FREE 100-player PvP mode in Fortnite. One giant map. A battle bus. Fortnite building skills and destructible environments combined ...</p>
        <% }else{ %>
            <p>There is no description for this game. Try Fortnite.</p>
        <% } %>

<% include partials/footer %>
body{
    background-color: black;
    color: green;
    font-size: 20px;
}
h1{
    color: pink;
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Illuminati Productions</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
const express = require("express");
const app = express();

//Sets the public folder as the external file folder
app.use(express.static("public"));

//Officially sets the view engine as ejs, therefore setting the default file type for readering to .ejs
app.set("view engine", "ejs");

app.get("/", function(req, res){
    res.render("homepage"); 
});

app.get("/game/:gameTitle/:gameCreator", function(req, res){
    const title = req.params.gameTitle;
    const creator = req.params.gameCreator;
    res.render("game", {
        title: title,
        creator: creator
    });
});

app.get("/gamelist", function(req, res){ 

    const games = [
        {title: "Fortnite", creator: "Epic Games"},
        {title: "Dirty Bomb", creator: "Splash Damage"},
        {title: "Battlefield 1", creator: "EA"}
    ]

    res.render("gamelist", {
        gamesList: games
    });
});

app.listen("3000", function(){
    console.log("Gaming Website has started up! Made by Illuminati Productions.");
});