My code below gives me an error: Error: Can't set headers after they are sent. If I put app.use('/special/... before app.use('/' ... it doesn't give me an error- 1. As I understand when using app.use the order does matter because the program doesn't look like when I use app.get for example, for anything after '/ or '/special/ so why am I getting an error? Also when I put app.use('/special/' first I am still not seeing "first" and second" but only the first one - even though I use next.. Can someone explain? Thanks!!
What does it mean?
var express=require ('express');
var app=express();
app.use('/',function(req,res,next){
res.send('first');
next();
});
app.use('/special/',function(req,res,next){
res.send('second');
next();
});
app.listen(3000, function(){
console.log('Server listening');
});