Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Matthew Francis
6,967 PointsRouting in express
Is there any difference between
var express = require("express");
var app = express();
//Method 1:
file1.js:
app.get("/stuff", function(req, res){
console.log("GET called")
})
//Method 2:
route.js:
var router = express.Router();
router.get("/stuff", function(req, res){
console.log("GET called")
})
One invokes the express variable, and one uses the Router method....is the router method preferred for organizational purposes when creating a routing module?

Kathryn Notson
25,941 PointsMatthew Francis:
Your first line of code says your application requires the Express.js dependency, the second line of code tells your app.js to use Express.js. The GET request is sent by the Express.js router to the server to retrieve data.
Jacob Mishkin
23,118 PointsJacob Mishkin
23,118 PointsI don't use express, I'm sorry i don't know your answer, but I'm sure someone here does.