I'll just give the run-down.
Server.js:
// load the things we need
var express = require('express');
var app = express();
// set the view engine to ejs
app.set('view engine', 'ejs');
// use res.render to load up an ejs view file
// index page
app.get('/', function(req, res) {
var tagline = "Any code of your own that you haven't looked at for six or more months might as well have been written by someone else";
res.render('pages/index', {
tagline: tagline
});
});
// about page
app.get('/about', function(req, res) {
res.render('pages/about');
});
app.listen(8080);
console.log('8080 is the magic port');
And in index.ejs, the bit I need to display is here:
<div class="jumbotron">
<h1>This is great</h1>
<h2><%= tagline %></h2>
<p>Welcome to templating using EJS</p>
</div>
However, when I run these codes together, I get all of the page, par the <%= tagline %>
part. This is very much an annoyance for me, as it means I currently cannot use EJS variables. Can anyone help?!