| page | https://idle.run/node-react-server |
|---|---|
| title | Webpack NodeJS Server with ReactJS Client |
| tags | nodejs react webpack |
| date | 2016-05-31 |
This project is a starter template for a web server project with:
- NodeJS server using Express 4
- ReactJS client packed up with webpack
- Ready for Heroku
Extra goodies:
- Webpack dev hot-reloading for client JS and CSS
- SASS support
- Static resource serving
- AJAX using JQuery
- Babel loader
morganandlog-timestampimprove Node console logging
Check out the project from github
git clone https://github.com/idlerun/node-react-server.gitInstall deps
npm installRun dev server locally
npm run devBuild the JS to static resources (in /public)
npm run buildRun the prod server with
npm start- Edit the server starting in
src/server/ - Edit the client starting in
src/client/
Browse the rest of the template and customize to your preference!
The app should be ready to deploy as a NodeJS app in Heroku.
Note that there is a postinstall script which Heroku will run after the npm install
command and will build the production JS and CSS resources. The dist folder should
not be committed to git.
