Running with Express and React

Still tip-toeing. Hilites today include:

  • $ npm install express –save
  • npm install –save-dev babel-cli babel-preset-react
  • $npm start  //uses entry point of the package.json file to run Node.


used babel to transpile the .jsx file in the src directory to a  .js file in the home directory served by using express’s static.

$ node_modules/.bin/babel src –presets react –out-dir static

then after putting that in the package.json:

"scripts": {
   "compile": "babel src --presets react --out-dir static",
   "watch": "babel src --presets react --out-dir static --watch",
   "test": "echo \"Error: no test specified\" && exit 1"
  • npm run compile, or
  • npm run watch

Leave a Reply

Your email address will not be published. Required fields are marked *