var express = require('express')
into
import express from 'express'
- npm i @babel/cli @babel/core @babel/node @babel/preset-env --save-dev
- npm i @babel/plugin-proposal-class-properties @babel/plugin-proposal-object-rest-spread --save-dev
- npm i rimraf nodemon --save-dev
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"build": "rimraf dist && babel src --out-dir dist --copy-files",
"start": "node dist/app.js",
"start:dev": "nodemon --exec babel-node src/app.js"
},
{ "presets": [ ["@babel/env", { "targets": { "node": "current" } }] ], "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread" ] }
https://dev.to/geekygeeky/get-started-with-es6-javascript-for-writing-nodejs-using-express-544h