How to use ES6 in Node using Babel

Install Babel CLI

npm install --save-dev babel-cli

Add Presets

$ npm install --save-dev babel-preset-es2015 babel-preset-stage-2

Add .babelrc

{
"presets": ["es2015", "stage-2"]
}

Add ES6 code to index.js

Add start script in pakage.json

"start": "babel-node index.js"

Start server

npm start