Kyle walks through all the functions that get pushed into his routes array. These functions include setting the server name, sending security headers, handling a multipart request and even perform operations like sending the favicon.
(dramatic electronic music)…- The next thing I want to talk about in terms of…how this code's working,…it's not so much about the re-usability but…how can I express things…in a simple way without needing some kind of framework.…Essentially,…I have that routes array that I was talking about so…I'm pushing functions into my routes array…almost identically to how you push middleware functions…into an express app.…If any of you done express work…and you do app.use or app.get,…this is the exact same concept…but I'm using an array rather than a framework.…
So basically,…I've replaced the express framework with an array…and my API is the array.push…rather than app.use.…The concept is the same,…that I have a function that's going to receive…a request and response stream…and it's going to decide if it should do something…with it or not.…So I have this series of routes that I define one at a time.…This first one sends out the server header…for all inbound requests.…This one sends out a set of security headers.…So, my content security policy…
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation
Skill Level Intermediate
2. Organizing Code
5. Adding a Shared Module
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.