SI 679 Week 01 — Course Intro, Express Intro Source: https://umich-mia.atlassian.net/wiki/external/MmNjZTg1NDkyNDQzNDM1MDg1OTI2NTRmZmE3MzEzMTA Author: Mark W Newman. Page last updated Sept. 08, 2026. Captured from the fully rendered public Confluence page Sept. 29, 2026. This is a detailed extraction of the rendered page, including every exercise requirement. It is not a verbatim transcript of lecture prose. HEADINGS AND LECTURE FLOW Welcome to SI 679! (Slide Deck) Getting Started with Express Create an Express project A First Route: Hello World Routes Getting data through POST Implement a POST handler Serve an HTML form Add Middleware for Form-handling Getting data through Query Strings Getting data from Route Params Errors & Status Codes Now You Try #1 Break! Announcements Postman POST with Postman Now You Try #2 EXPRESS SETUP AND EARLY ROUTES - In a course code directory, create week1hello; run npm init -y and npm install express@latest. - In package.json use "type": "module", "main": "server.js", and a start script equivalent to "node --watch server.js". The page's example dependency is express ^5.2.1. - In server.js import express from 'express', construct app = express(), choose port 3000, define app.get('/', handler) that sends 'Hello World!', then app.listen(port). Run node ./server.js and visit http://localhost:3000. - Observe that /about fails until an app.get('/about', ...) handler is added. The sample sends 'Welcome to the About page!'. - POST /submit uses app.post rather than app.get. Visiting /submit in a browser address bar sends GET, so it does not reach the POST handler. - GET /contact serves a form with first and last name fields, method="post", action="/submit". Submitting it reaches the POST route. - app.use(express.urlencoded()) before route definitions parses form-encoded request data; destructure fname and lname from req.body and include them in the response. Middleware sits in the request-response loop and can rewrite the request object before the handler. - A query string follows ? and contains key=value pairs separated by &; URL encoding such as %20 can represent a space. Read it through req.query. The /people example searches an array by first letter. Try letter values c, f, and 3; then missing/wrongly named/malformed parameters (ltr=c, an unusual multi-? string, and no query). The sample directly indexes letter[0], demonstrating why missing input needs validation. - Route parameters are in the path, e.g. app.get('/person/:id') reads req.params.id and app.get('/league/:leaguename/team/:teamname') reads both. The page shows /person/:id but asks the reader to try /people/33, a path mismatch in the source. - res.status(code).send(content) sets response status. Default is 200. The example returns 400 when /person/:id is not numeric; 500 is a generic server failure. NOW YOU TRY #1 — WEEK 1 REPO Accept the Week 1 NYT Classroom50 assignment, clone the resulting repo, implement as many routes as time allows, and push the work. The route/response cases shown are: 1. GET /catalog?itemid=222 -> "Oh, you’re looking for item 222?" 2. GET /catalog?itemid=3 -> "Oh, you’re looking for item 3?" 3. GET /catalog?itemid=xyz -> status 400, "Error: itemid must be a number" 4. GET /play/artist/Radiohead/song/Creep -> "You want to listen to Creep by Radiohead?" 5. GET /play/artist/The%20Clash/song/London%20Calling -> "You want to listen to London Calling by The Clash?" 6. GET /getform renders an HTML form with Address, City, Zipcode, and Submit; the form action is /submitform. The submitted sample response is "Great! Your package will be shipped to 123 Main St, Smallville, 01234". 7. GET /browse/frozen?keywords=organic+corn -> "Searching for organic corn in the frozen category". Use both a route parameter and a query string. 8. GET /browse/meat?keywords=rotisserie+chicken -> "Searching for rotisserie chicken in the meat category". Use the same route pattern. The linked solution repo is https://github.com/SI679-internal/week1-nyt. POSTMAN LECTURE - Postman permits testing HTTP requests other than browser address-bar GETs. The page asks the reader to create a collection SI 679, folder Week1, and a GET request named hello for http://localhost:3000/. Start the lecture server and confirm Hello World! in Postman. - Create a request postData with method POST and a raw JSON body. Before its route exists, expect Not Found. Add app.use(express.json()) before routes, then POST /postData reads firstName and lastName from req.body and responds "Hello !". - These Postman activities are in the lecture project, while Now You Try continues in the NYT repo. NOW YOU TRY #2 — CONTINUE WEEK 1 NYT REPO Add routes matching the following request/response cases: 1. GET /hithere?name=Mark+Newman -> "Hi there, Mark Newman". 2. POST /tracks with raw JSON {"artist":"The Cure","title":"In Between Days","album":"The Head on the Door","year":"1985"} -> JSON with status:"success", trackAdded containing the submitted fields, and a timestamp in ISO form (the page illustrates 2026-09-03T12:30:51.899Z). 3. POST /tracks missing artist -> status 400 and "artist must be a valid, non-empty string". 4. POST /tracks missing title -> status 400 and "title must be a valid, non-empty string". 5. GET /products/electronics/tvs?keywords=lcd,smart,sony -> "You are looking for [lcd AND smart AND sony] in electronics/tvs, aren't you?" 6. GET /products/household/kitchen?keywords=timer,analog -> "You are looking for [timer AND analog] in household/kitchen, aren't you?" The page explicitly says the two product examples should use the same route. The same solution repo is linked: https://github.com/SI679-internal/week1-nyt. ANNOUNCEMENTS SHOWN ON THE PAGE TypeScript Basics was an in-class/Canvas/Classroom50 assignment due Sept. 14 at 11:59pm. Two About Me assignments were listed for Sept. 10. The instructor said the first homework would begin a pizza restaurant backend series. These are historical page announcements, not current deadlines.