Skip to content

Instantly share code, notes, and snippets.

@mckoyd
Last active July 20, 2025 07:42
Show Gist options
  • Select an option

  • Save mckoyd/76aba4251441d091d432e9bf08eee267 to your computer and use it in GitHub Desktop.

Select an option

Save mckoyd/76aba4251441d091d432e9bf08eee267 to your computer and use it in GitHub Desktop.
1. Describe the HTTP requests/response lifecycle.
Amazing site on describing the entire process in visual detail.
https://dev.to/dangolant/things-i-brushed-up-on-this-week-the-http-request-lifecycle-
Amazing video describing the process with cool visual effects
https://www.youtube.com/watch?v=eesqK59rhGA
Slides courtesy of Chris Klanac and Thinkful
http://thinkful.slides.com/thinkful/node-express#/4
==================================CONVERSATIONAL===========================================
When a user/client types a URL into their favorite browser, the BROWSER understands this as
a request using the GET method to a server and first gets the protocol (http protocol in most instances),
then the host (like www.google.com), sometimes a port number (though optional), and the resource path
(like /api or /index.html). If there's a query string (denoted by a ?), it will come after the
resource path (for example ?searchTerm=gaga). (If we were using something like a POST method,
a payload or body will be added to the request).
If successful, the server sends a response (for example its payload may include
html pages, css, js, and other resources), a status code (in this case 200), and some header
information.
==================================FROM THE READING==========================================
First, a client makes a request to an HTTP server. The client opens a connection to the server and sends a request message.
At a minimum, the request message contains the request method (GET, POST, PUT, PATCH, or DELETE), the HTTP protocol and
version being used, as well as the host (e.g., www.example.com). The request may also contain a body if, for instance, the
user is posting a form or uploading a file.
- Request:
-
2. Describe the architecture of a basic Express app. How is it organized?
A thorough, readable description of both Node and Express
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Introduction
==================================CONVERSATIONAL===========================================
Well Express is a popular web framework for Node, so let me explain Node first.
In short, Node is a runtime environment that allows developers to code in JavaScript
outside of the browser, allowing the ability to create server-side apps using only
JavaScript. Node also has its own package manager with a dependency resolution
that can be used to automate the apps build tools (starting with a simple npm install).
Back to Express, its library gives us the ability to write handlers for CRUD methods,
as well as set up the port for connecting and construct the template for the response.
Express uses "middleware", allowing us to handle the request from the client side
in a chain of processes (most including promises that handle asynchronous operations).
A sample Express architecture will include a server.js file that 'requires' the express
module, handles a request at any or all endpoints via middleware as well as any errors,
then 'listens' on a specified port number.
3. Tell me about a time when you've used Express Router. How was it helpful?
Refer to previous resource.
==================================CONVERSATIONAL===========================================
Express Routers help add modularity and readability to your app file structure. I've used them
in apps in which I would run different HTTP verbs on a number of different endpoints.
Keeping all of these handlers in the server file can get cumbersome and make it difficult to find
bugs reading all of that code in one place. With Express Routers, you can move all CRUD
methods that relate to a specific api into its own folder and files, exporting the router to use
in your server.js file via module.exports. This is also extremely beneficial for others
reading your code, making it much easier to follow, enhance, debug, etc.
4. What's your experience with continuous integration? How has it helped you?
Slides courtesy of Chris Klanac and Thinkful
http://thinkful.slides.com/thinkful/mocha-chai#/
==================================CONVERSATIONAL===========================================
Continous integration is awesome; we can constantly make changes to the code, testing to
ensure that no functionality was broken. In my experience, which has recently been in test-driven
development, the continuous integration process has been to write tests, then write code to pass
those tests, then set up a separate server (like Travis CI whcih is set up to work with GitHub)
to run tests every time you commit so that each feature is tested for each developer
each time they change their code. That way, if a feature does not pass all tests, it doesn't get
included in the final production.
5. Describe how a Mongo database is structured.
Mongo CheatSheet from Thinkful
https://drive.google.com/file/d/0BzxWJx1gb9orbmtmdlVBTWd5aUU/view
Slides courtesy of Chris Klanac and Thinkful
http://thinkful.slides.com/thinkful/mongodb#/
==================================CONVERSATIONAL===========================================
The easiest way for me to describe this is by comparing the Mongo database to the SQL
database. In SQL, each database is organized into tables. In Mongo, each database is
organized into collections (which is represented via BSON, extending the JSON model to provide additional data types, ordered fields,
and to be efficient for encoding and decoding within different languages). While a table will have a number of columns and rows,
a collection will have a number of documents each with its own fields. And although there
are many similarities between SQL databases and Mongo databases, the major difference is
that Mongo databases are extremely flexible in how the document is stuctured (each document
is not required to have the same amount of fields) while SQL requires each row to have the
same amount of columns. SQL also needs it data to be structured before inserting data,
whereas Mongo is flexible enough to accept unstructured data.
================================REMEMBER==========================================
Don't forget to study: SQL joins compared to references in Mongo, ORM's (Object relational mapping)
for SQL (like knex) versus Mongo (like mongoose)
6. How do JSON web tokens work?
==================================CONVERSATIONAL===========================================
JSON web tokens give users temporary authorization to access protected end points.
7. What is the purpose of bcrypt in the authentication process?
==================================CONVERSATIONAL===========================================
Bcrypt allows us to hash passwords (which conveniently gives developers a one-way transformation,
that makes it difficult to recover passwords from hashes) and adds a salt
(which provides a unique string of letters and numbers to add to the hash as an extra layer of
security). The major difference between bcrypt and other hashing modules like md5 is that
bcrypt hashes passwords slowly, increasing the time it would take a potential attacker to
crack the hash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment