Template for Node.js express projects
After following the steps below a local repository explorer should show two remotes:
origin- this is the repository where you create your project
upstream- this is the repository where you can get template updates
Make sure always to push your changes to the origin remote since you
will not be able to change the contents of the upstream remote.
Create a new git repository (e.g. on GitHub). Make sure not to select
"Initialize this repository with a README".
Clone the repository to your local machine
git clone https://github.com/USER/NEW-REPOSITORY.git
Add this template as an upstream remote to keep it up to date if we change or update things.
git remote add upstream https://github.com/gerarts/template-nodejs.git
Pull the contents of this template on your local machine.
git pull upstream master
Your local copy should be exactly the same as the template.
Push the template to your new repository and start working from there.
git push origin master
Enable your new repository on Travis-CI and enable branch protection for
the master branch to ensure tests pass for the code in the master
branch.
expressas the environmentbody-parserforPOSTrequestscookie-parserfor cookiesmysqlfor database connectionsejsfor page creation
eslintfor code style with configuration setistanbulfor coverage reportingmochaas a testing frameworkjsdocfor documentation generationtravis-ciconfiguration set.gitignoreconfiguration set
startstarts the servertestruns the testscoveragegenerates a coverage reportjsdocgenerates the jsdoccleanremoves the coverage report and jsdoc if they existrefreshdeletesnode_modulesand re-installs all the dependencies