JSON Link Challenge

0 Grant Broadwater · January 13, 2016
Added one line to VideoData.json:
{
"categoryName": "Appetizers & Sides",
"baseURL": "https://www.thenewboston.com/videos_food.php?cat=", // <-- New Line
"categories": [
...
]
}

Then index.ejs is:
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css'/>
</head>
<body>

<h1><%= videoData.categoryName %></h1>

<ul>
<% videoData.categories.forEach(function(item){ %>
<li>
<a href="<%= videoData.baseURL %><%= item.categoryID %>">
<%= item.categoryName %>
</a>
</li>
<% }); %>
</ul>

</body>
</html>

Post a Reply

Replies

Oldest  Newest  Rating
0 Kaan Karaca · July 5, 2016
index.ejs file should look like this: 

<body>

   <% include templates/header.ejs %>

   <p><%= videodata.categoryName %></p>

   <ul>
       <% videodata.categories.forEach(function (item) { %>
           <a href="https://thenewboston.com/videos.php?cat=<%=item.categoryID%> "> <li><%= item.categoryName%></li> </a>
      <% });%>
   </ul>
</body>
  • 1

Node.js

94 followers
About

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Links
Moderators