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

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

#1

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.

Thanks!

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

app.use(stylus.middleware(STATIC_DIR))
app.use(express.static(STATIC_DIR))

app.listen(process.argv[2])

#2

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.


#4

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.