This is a boilerplate project used for starting new projects!
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
- Move the example Environment file to
.env
that will be ignored by git and read by the express servermv example.env .env
- Edit the contents of the
package.json
to use NEW-PROJECT-NAME instead of"name": "express-boilerplate",
Start the application npm start
Start nodemon for the application npm run dev
Run the tests npm test
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" and you can then npm run deploy
which will push to this remote's master branch.
Create migrations with following command:
knex migrate:make create_bookmarks --debug
exports.up = function(knex) {
return knex.schema.createTableIfNotExists("bookmarks", function(table) {
table.increments('id').primary();
table.string('title').notNullable();
table.string('url').notNullable();
table.timestamp('rating');
table.boolean('description').defaultTo(false);
table.timestamp('date_created').defaultTo(knex.fn.now());
table.timestamp('date_updated').defaultTo(knex.fn.now());
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists("bookmarks");
};
Run migrations in debug mode on development environment with following command:
knex migrate:latest --debug --env development
Run migrations in debug mode on production environment with following command:
knex migrate:latest --debug --env production