Academy-Records is a simple CRUD application built using mongo, nodejs and express. It is written using ES6 javascript and it incorporates babel for transpiling server-side code to ES5 and webpack for bundling client-side modules
clone the repo
cd into repo directory
setup a .env file in the project root directory with the following fields:
ENV
mongoDBDev
mongoDBProd
npm install
npm run build
npm start
Note : Please make sure your MongoDB is running. For MongoDB installation guide see this. You can also set up a mongo database on Mongolab
Also you may want to change the node and npm version in package.json to the version
you're running. npm3 is required to install dependencies properly.
- Set
ENV=developmentin .env file - Set
mongoDBDev=connection_stringin .env file - Run command
npm install - Run command
npm run build - Run command
npm start - Navigate to
localhost:3000in your browser
- Set
ENV=productionin .env file - Set
mongoDBProd=connection_stringin .env file - Run command
npm install - Run command
npm run build - Run command
npm run production-bundle - Run command
npm start - Navigate to
localhost:3000in your browser
Consult this documentation
Note: You will need to set up config vars in order to configure ENV and
mongoDBProd options. The Procfile is setup already. Using Heroku CLI,
You will have to run heroku config:set NPM_CONFIG_PRODUCTION=false
in order to install devdependencies for building and bundling code.
webtrack-assessment uses Webpack for bundling modules. There are two
types of webpack config provided: webpack.config.js for development
and webpack.prod.config.js for production.
npm start- starts express server with hot loading enablednpm run lint- runs eslint to check for lint errorsnpm run removebuild- deletes build foldernpm run transpile- converts server-side ES6 code to ES5 buildnpm run build- removes build folder and converts server-side ES6 code to ES5 buildnpm run production-bundle- creates client-side production bundlenpm run postinstall- command runs after installation of node modules - useful on code deploy to cloud providers like herokunpm run heroku-postbuild- heroku specific command that builds client-side production assets