Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created June 20, 2014 15:45
Show Gist options
  • Save ajcrites/7e1f73344266cfe78807 to your computer and use it in GitHub Desktop.
Save ajcrites/7e1f73344266cfe78807 to your computer and use it in GitHub Desktop.
var express = require("express"),
nonAuthRouter = express.Router(),
authRouter = express.Router(),
app = express();
authRouter.use(function (req, res, next) {
console.log("This is a routers");
next();
});
nonAuthRouter.get("/foo", function (req, res) {
console.log("foo");
res.end();
});
authRouter.get("/bar", function (req, res) {
console.log("bar");
res.end();
});
app.use(nonAuthRouter);
app.use(authRouter);
app.listen(process.env.PORT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment