UMass Lowell Dept. of Computer Science

COMP 4620 — GUI Programming II

Spring 2016 Semester, Section 201

Prof. Jesse M. Heines

Notes for Class No. 6

Introduction to Assignment No. 2: Alpha Version, and Introduction to Building a Static Site with Node and Express

Thursday, February 4, 2016

A video of this class is (or will be) posted at:  http://echo360.uml.edu/heines2016/comp4620-201.html


Handouts and Materials

A proposal written by me


Openings / Announcements / Reminders

In response to a student request, I have now posted due dates on all the project-related assignments for this semester

In response to another student request, I have posted a proposal written by me


Class Notes

Related reading for this class:  GetMEAN: Chap. 4


Introduction to Assignment No. 2

I must say that I am very pleased to see people discussing project management software on Piazza

This is *not* an area that I know much about, so it is wonderful to see fellow students sharing their experiences


Review of Assignment No. 2 write-up


Getting MEAN, Chapter 4

“In chapter 3 you should have had an Express application running, set up in an MVC way, with Bootstrap included to help with building page layouts.  Our next step is to build on this base, creating a static site that you can click through.  This is a critical step in putting together any site or application.  Even if you’ve been given a design or some wireframes to work from, there’s no substitute for rapidly creating a realistic prototype that you can use in the browser.  Something always comes to light in terms of layout or usability that hadn’t been noticed before.” (p. 80)

Why else is it useful to have “a realistic prototype that you can use in the browser”?

The goal of this chapter is to “have intelligent views that can display data passed to them, and controllers passing hard-coded data to the views.” (p. 81)


4.1 Defining Routes in Express (p. 82)

What is a route?

Holmes’s “collections” of pages (p. 82)

File relationships (p. 83)

“The application includes the routes file, which in turn includes multiple controller files, each named according to the relevant collection.” (p. 83)

What’s where

Loc8r
└──app_server
    ├──controllers
    │     locations.js
    │     main.js
    │     others.js
    ├──routes
    │     index.js
    │     users.js
    └──views
          error.jade
          generic-text.jade
          index.jade
          layout.jade
          location-info.jade
          location-review-form.jade
          locations-list.jade

The loc8r/app.js file

The loc8r/app_server/routes/index.js file


4.2 Building Controllers (p. 84)

The loc8r/app_server/controllers/main.js file

The loc8r/app_server/controllers/others.js file (p. 85)

The loc8r/app_server/controllers/locations.js file (pp. 85-86)

This should now work if you enter the following URLs


4.3 Creating Views (p. 87)


Bootstrap Responsive Grid System (p. 88)


The Basic Application Layout (p. 89)

“This framework for a layout is pretty simple, but it suits our needs. It will give a consistent look and feel, while allowing for all types of content layouts to go in the middle.” (p. 90)

“Creating the framework in a layout file means that you only have to do it once, and only have to maintain it in one place.” (p. 90)

The initial loc8r/app_server/views/layout.jade file (p. 90)

Adding a navigation section above teh content block and a footer below it (pp. 90-92)


Building the Homepage template (p. 93)

(1)  Create a new view file:  loc8r/app_server/views/locations-list.jade

(2)  Modify the controller for the homepage in loc8r/app_server/controllers/locations.js to use this view (p. 94)

module.exports.homelist = function(req, res){
  res.render('locations-list', { title: 'Home' });
};

(3)  Code the 3 main areas of the page (p. 95) — file loc8r/app_server/views/locations-list.jade



This is document http://jesseheines.com:8080/~heines/91.462/91.462-2015-16s/462-lecs/lecture06.jsp.  It was last modified on Friday, August 26, 2022 at 4:09 PM.
Copyright © 2022 by Jesse M. Heines.  All rights reserved.  May be freely copied or excerpted for educational purposes with credit to the author.