If you have to execute a function only if condition is true, you can use short-circuit.
// Instead of this
if (condition) {
doSomething();
}
// You can use short-circuit
condition && doSomething();
Logical AND
In JavaScript, the logical AND operator will return true if both operands are true. It returns false in any other scenario. Here are a few simple examples:
true && true
// true
true && false
// false
false && false
// false
Middleware functions are functions that have access to the request...
var logger = function (req, res, next) {
console.log('logged')
next()
}
Error Handling refers to how Express catches and processes errors...
app.get('/', function (req, res, next) {
fs.readFile('/file-does-not-exist', function (err, data) {
})
Designed & Built by Mijo Kristo