solution_Destructuring_Assignment_ES6
by upigilam
JavaScript
// solution to What's the correct way to use Destructuring Assignment in ES6?
var jsonMiddleware = require('body-parser').json
var body = req.body, // body has username and password
username = body.username,
password = body.password
In ES6:
var {jsonMiddleware} = require('body-parser')
var {username, password} = req.body