Skip to content

elewa-academy/express-middleware-series

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

middlware are simply functions your server can use
app.use and app.set configures the express app



good articles:  - sort them
	https://stormpath.com/blog/how-to-write-middleware-for-express-apps
	https://www.safaribooksonline.com/blog/2014/03/10/express-js-middleware-demystified/
	https://stackoverflow.com/questions/7337572/what-does-middleware-and-app-use-actually-mean-in-expressjs

https://evanhahn.com/understanding-express/
	quite nice but a touch annoying
his codes to read-spec-write
	https://github.com/EvanHahn/Express.js-in-Action-code/blob/master/Chapter_03/guestbook/app.js



handlers vs middleware
	http://qnimate.com/express-js-middleware-tutorial/
	https://stackoverflow.com/questions/35676259/understanding-middleware-and-route-handler-in-express-js


why middleware?  
	logging
	configuring
	things 

middleware vs handlers
	handlers for res, req. (roughly)
	middleware for configuring main app, handlers just for req/res
	use: if path starts with indicated
	all: if path is whole thing
	position: middleware goes before handlers
		won't be executed once handlers are started
	middleware: error handling - middleware at end
		https://github.com/EvanHahn/Express.js-in-Action-code/blob/master/Chapter_03/guestbook/app.js

middleware:
	config, errors, 
	res.locals only. (ap.loc persists between cycles)
	in app.js
	auth and sessions

handlers:
	res building
	in router.js

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published