Skip to content

LearnAllTheNodes/episode27

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn All The Nodes Episode 27

What's new in Express 4 (Part 2 - the router)

View the episode

Notes

Express 4 migration guide

Express 4 router documentation

router.use

Episode code

var adminRouter = express.Router()

adminRouter.use('/', ensureAdmin)
adminRouter.route('/users')
  .get(formRoute)
  .post(genericRoute)
adminRouter.get('/accounts`', genericRoute)
adminRouter.get('/transactions', genericRoute)

var authRouter = express.Router()
authRouter.get('/sign_in', genericRoute)
authRouter.get('/sign_out', genericRoute)
authRouter.get('/register', genericRoute)

var coreAppRouter = express.Router()
coreAppRouter.get('/widgets', genericRoute)
coreAppRouter.get('/tasks', genericRoute)

app.use('/admin', adminRouter)
app.use('/auth', authRouter)
app.use('/app', coreAppRouter)

About

What's new in Express 4 (Part 1 - the router)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published