This is a boilerplate project used for starting new projects! Created with guidance from Bloc/Thinkful curriculum. This project creates an Express server equipped with appropriate middleware & testing libraries, which is built to interface with PostgreSQL database including SQL query building and database migrations.
Complete the following steps to start a new project (NEW-PROJECT-NAME):
- Clone this repository to your local machine
git clone BOILERPLATE-URL NEW-PROJECTS-NAME
cd
into the cloned repository- Make a fresh start of the git history for this project with
rm -rf .git && git init
- Install the node dependencies
npm install
- Edit the contents of the
package.json
to use NEW-PROJECT-NAME instead of"name": "express-boilerplate",
- Move the example Environment file to
.env
that will be ignored by git and read by the express servermv example.env .env
- Edit
.env
file with true environment variables. Editconfig.js
DB_NAME to your database name and username. - Create migrations folder for postgrator
mkdir migrations
- Start the application:
npm start
- Start nodemon for the application:
npm run dev
- Run tests:
npm test
ornpm t
- Run tests in watch mode:
npm run test:watch
- Migrate local database:
npm run migrate
When your new project is ready for deployment, add a new Heroku application with heroku create
. This will make a new git remote called "heroku".
Check postgrator-production-config.js
file to update production database variables.
Run npm run deploy
which will do an NPM audit, migrate the production database, and push to this remote's master branch.