Short-circuits conditionals

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

You can also read this

Simple REST API with ExpressJS

Express is a minimal and flexible Node.js web application framework...

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

Routing in Node.js with Express.Js

In this post I will try to explain how routing...

app.get('/', function (req, res) {
  res.send('hello from me')
})