Request Parameters

Send Request: In your client JavaScript, send a GET request with a query string parameter:
let request = new XMLHttpRequest()
request.open(`GET`, `/yourRoute?yourParameterName=yourValue`)
request.send()
Parse Request: In your server JavaScript, extract the query string parameter from the request:
app.get(`/yourRoute`, (request, response) => {
  let yourValue = request.query.yourParameterName
})

Embedded JavaScript

Add Package: ejs
Set View Engine:
app.set(`view engine`, `ejs`)
Move HTML File: Add a new folder called views, and move your HTML file to that folder.
Rename HTML File: Rename your HTML file to end in .ejs instead of .html.
Render HTML File: Replace response.sendFile with response.render:
response.render(`index`) // if your HTML file is called index.ejs
Render data: Render HTML with data:
let data = {
  yourKey: yourValue
}

response.render(`index`, data)
Embed data: In your HTML, embed the data:
<%= yourKey %>

Session Data

Add Package: express-session
Include Module:
let session = require(`express-session`)
Configure Module:
app.use(session({
  secret: `your secret string`,
  resave: false,
  saveUninitialized: false,
  cookie: {
    // how long the session will last
    // put null to have session end when client closes browser
    maxAge: someMilliseconds
  }
}))
Set Session Variable: Access the session object from the request object, and add your own variables to the session object. Those variables will be available to that client only:
request.session.yourVariable = something
Get Session Variable: Access the session object from the request object, and access your variables from the session object. You can access variables that were added by that client only:
request.session.yourVariable
Destroy Session: Access the session object from the request object, and remove all variables that were added by that client:
request.session.destroy()
More Info: npm page

Uploading Files

Create Form: In your HTML, create a form with a file input and submit button:
<form action="/yourRoute" method="POST" enctype="multipart/form-data">
  <input type="file" name="yourFileInputName">
  <input type="submit">
</form>
Add Package: formidable
Include Modules:
let formidable = require(`formidable`)
let fs = require(`fs`)
Add Folder: Add a new folder for uploaded files.
Create Endpoint: Create an endpoint to match your form.
Save File: In your file upload endpoint, get the file from the request and save it to the new folder:
let form = new formidable.IncomingForm()
form.maxFileSize = 25 * 1024 * 1024 // 25 megabytes

form.parse(request, saveFile)

function saveFile(error, fields, files) {
  let temporaryPath = files.yourFileInputName.path
  let permanentPath = `${__dirname}/yourFolder/${files.yourFileInputName.name}`

  // copy uploaded file to new folder
  fs.copyFileSync(temporaryPath, permanentPath)

  // delete uploaded file at temporary location
  fs.unlinkSync(temporaryPath)
}
More Info: npm page

Sending Requests

Add Package: axios
Include Module:
let axios = require(`axios`)
Send Request: Send a request:
axios.post(someUrl)
Send Data: Send a request with data:
let data = {
  yourKey: yourValue
}

axios.post(someUrl, data)
Process Response: Send a request with data and process the response:
let data = {
  yourKey: yourValue
}

axios.post(someUrl, data).then(processResponse)

function processResponse(response) {
  // write code here to do something with the response
  // you can get what was returned with response.data
  // you can get what was sent with response.config.data
}
More Info: npm page

Reading Files

Include Module:
let fs = require(`fs`)
Read File: Read a file:
let contents = fs.readFileSync(yourFile, `utf8`)

// write code here to do something with the file contents
// you can split the contents into separate lines with contents.split(`\n`)
More Info: module page