Need two lines of code from Stylish CSS in the ExpressWorks tutorial explained to me please

Can anybody explain exactly what is going on in lines six and seven of the code below? If I understood this it would unlock lots of other stuff for me in understanding Express.


var express = require('express')
var app = express();
var stylus = require('stylus') 
var STATIC_DIR = process.argv[3]



app.use(stylus.middleware(STATIC_DIR)) - look for Stylus sheets and compile them

app.use(express.static(STATIC_DIR)) - serve static files (HTML/CSS/JS) from STATIC_DIR

Read about express middleware.

1 Like

Thank you, that gives me a really good framework to understand what is going on. I have much more to learn about what middleware is doing but this is a great primer.