-
Always refer to http://expressjs.com/api.html
-
Everything is “middleware”.
-
use means “Run this on ALL requests”
-
get means “Run this on a GET request, for the given URL”
-
in between middleware should return
next()
orres.end()
-
Ends the response process.
res.render('/homepage'); res.send('Hello World!'); res.json({}); res.end(); res.status(404).end();
-
middleware and async are different
-
always chain middleware
-
use async inside middleware
-
use async when handling a request, and especially when that involves doing file I/O or talking to a database.
Last active
August 29, 2015 14:23
-
-
Save ralphcrisostomo/637f89e6d4d8495adab9 to your computer and use it in GitHub Desktop.
Express.js Learning Notes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment