router vs app in express 4.0
问题 I am learning express js 4.0 and building compact CRUD REST API web application with it. In the tutorial, it shows two ways; using app and using router. //using router var router = express.Router(); router.get('/', function(req,res){ res.send('hello, world') }); //using app app.get('/', function(req,res){ res.send('hello, world') }); To me, I feel they work same but I don't know why people use router , I think using app is more simple. Can anybody explain what is difference between them? 回答1: