This is a boilerplate mean application using Node, Express, Angular, mongo (mlab), Heroku, Gulp
- Download the repo and run
npm install
- create a .env file in the root directory with the following paramters
- MAILGUN_USERNAME
- MAILGUN_PASSWORD
- MONGODB
- TOKEN_SECRET
- MongoDB connection string can be local or hosted (e.x. mongolab)
- Token Secret should be a strongly generated alpha-numeric string
- Ensure gulp is install globally (possibly other dependencies if running throws dependency errors)
MAILGUN_USERNAME='postmaster@sandbox67c118365e564798a8864434e4b2a3cb.mailgun.org'
MAILGUN_PASSWORD='ed49d942fd9e6c11208ee3aacb29df9d'
MONGODB='localhost'
TOKEN_SECRET='dc1c7e6b02a286885dcdfsd543498lkj578a97bd45d57ec531e7397b8a67'
Run npm build
of gulp build
to build one JS application file and another JS template file in public/js
Run either 'npm start
- Build -
npm build
- Start server -
npm
- Watch file changes -
npm watch
- Create a standard launch.json run file py pressing F5 and chooseing Node.js
- Create a new task
ctrl+shift+p
and typetask
and choose configure task runner. Se sample below - Run server with
F5
and then run watch task withctrl+shift+p
and typetask
and choose run task and choose default - This should open up browser window with brosersync that will refresh with any front-end changes. For backend changes, you will have to restart the server.
.vscode/task.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"args": ["--no-color"],
"showOutput": "always",
"tasks": [
{
"taskName": "default",
"args": [],
"isBuildCommand": true,
"isWatching": true
}
]
}
only Heroku instructions included
- Create a heroku application
- Set global variables on heroku using CLI or the web console.
- MAILGUN_USERNAME
- MAILGUN_PASSWORD
- MONGODB
- TOKEN_SECRET
- Follow Heroku instructions here for setting a remote
- ansure any changes made are added/committed to git
- run
git push heroku master
to deploy - ENJOY!