Skip to content

Packageless Express Flash Middleware

Notes

  • Date Posted: June 6, 2021

Packageless Express Flash Middleware

Packages are a great way to shave off development time, but there’s a few reasons why I like to keep my project dependencies small.

  1. I’m probably not going to use most of the features provided
  2. Why install someone else’s code when I know I can do it myself? Especially if it’s something I’ve never worked on before (like the title of the post)
  3. It’s not 100% what I need
  4. It’s fun to learn how something works and be able to build it as oppose to just running npm install
  5. If the package I’m not familiar with causes my project to fail, it’s going to be difficult to pinpoint the source.

The actual middleware is on lines 2 – 32. In total the script it 17 lines of code. It’s a simple key value pair. What you put in, you get out.