var express = require('express');
var app = express();
var puppies = require("./controllers/puppies");
app.set('view engine', 'ejs');
app.set('views', "./views");
app.use("/puppies", puppies);
What does "view engine" do?
Where does it go in an express app?
How do I tell the server where to find views?
<body>
<h1><%= title %></h1>
<ul>
<% for(var i=0; i<supplies.length; i++) {%>
<li><%= supplies[i] %></li>
<% } %>
</ul>
var express = require('express');
var router = express.Router();
router.get("/", function(req,res) {
res.render("puppies", puppyData)
});
views/puppies.ejs
controllers/puppies.js
npm install View Engine
Create Index.ejs
res.render("index", data)
Add a View Engine (EJS) & Views Folder to your express server
Loop through each Puppy and show it's name and picture
Create an Express Server
Create a file called puppies.ejs
Use res.render() to send the HTML to your browser!
20 Minuites
What did you like vs EJS?
What was more difficult?
How much work was it to translate?