Challenge #1

0 Michael Kornelakis · April 11, 2015
index.js is:

var express = require('express');
var router = express.Router();
var vd = require('../videodata.json');

/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', {
title: 'Komic',
baseUrl: '',
videodata: vd

module.exports = router;

and index.ejs is below (for some reason if I add a second code block it won't show up)

<!DOCTYPE html>
       <title><%= title %></title>
       <link rel='stylesheet' href='/stylesheets/style.css' />

        <% include templates/header.ejs %>

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

         <% videodata.categories.forEach(function(item){ %>
         <li><a href="<%= baseUrl %>cat=<%= item.categoryID %>"><%= item.categoryName %></a></li><% }); %>


Post a Reply


Oldest  Newest  Rating
0 Michael Kornelakis · April 16, 2015
I deleted my second post. In the first post I have the code in plain text...There's nothing wrong with it, I just posted it for others to see! :)
0 Pere Garau Burguera · April 14, 2015
For some reason (the code thing has some problems I have to say) it's not showing. Post the code directly without the tags. This also could help us see what's wrong with it
  • 1



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.