In this article, we will learn how to use ES6 syntax to write your Node Server in few simple steps.
Babel is a toolchain that is mainly used to convert ECMAScript 2015+
older browsers or environments. Here are the main things Babel can do
Installation with npm
npm install --save-dev @babel/core @babel/node @babel/preset-env
Installation with yarn
yarn add @babel/core @babel/node @babel/preset-env -D
After successful installations of dev-dependencies create a file named .babelrc like this.
Now you can run your node.js project with ES6 features by running the following command.
yarn babel-node index.js
npx babel-node index.js
That is it for this short article.
I am writing this first time please forgive me for my mistakes. I hope you guys find it informative.