For this module, you are going to create a very simple shopping site that allows you to browse items (from a "database") and
add a new review to an item. Open up
http://localhost:8080/items.html
to see the mockup of the product you're creating.
Next, you will replace the static mockup
items.html
with a template and dynamic HTML generation. Follow the video example
below to:
- Configure your server to use EJS templates
- Convert the
items.html
mockup into an EJS template
- Create an
/items
GET route that renders the template
- Create a fake "database" (an associative array) with your own list of items (each item should have name, description, price, image URL)
- Update the
/items
route and the template file to display from the "database"
Additional Reference:
EJS website
The documentation mostly deals with different ways to use the engine, since the actual templating part
is simply: you can put in JavaScript. The list of "Tags" about halfway down the page details various
alternatives to the basic <% %>
.