Start with the Functional Spec which also gives the backstory for this project.
Follow the steps below. Please make a pull request if any of this isn't super straightforward or you need to do additional steps to get up and running!
Set Up The Database
Start it with running either
brew services start postgresql
to have it as a background service that will restart if you reboot or
pg_ctl -D /usr/local/var/postgres start to start it just once.
Start it with the command
sudo service postgresql start
to have it run as a background service that will restart if you reboot or
sudo -u postgres /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
which runs the script as the automatically created PostgreSQL user account to
start it just once.
postgresql is running on
localhost:5432. If you run
/tmp:5432 - accepting connections.
Run the following to create a user and a database. If prompted for a
password, use the password
createuser -P iwill createdb -O iwill commitsto
sudo -u postgres createuser -P iwill sudo -u postgres createdb -O iwill commitsto
Set Up Hosts File For Subdomains
Add the following line to
/etc/hosts with whatever subdomains you want to be available:
127.0.0.1 commits-to.js www.commits-to.js alice.commits-to.js bob.commits-to.js
You should also add any subdomain you will to use to create test
commits to the list
USERS in the file
db/seed.js , e.g.:
const USERS = [ /* testing */ 'alice', 'bob', 'carol', 'deb', 'my_new_username', ]
Make sure to re-seed the database if you make changes here.
Create Environment File
.env file in the root of the project directory with the following contents,
<yourname> with your name:
ENV_NAME=<yourname>-dev PORT=8080 APP_DOMAIN=commits-to.js:8080 DATABASE_URL=postgres://iwill:iwill@localhost:5432/commitsto # Optional MAILGUN_KEY= MAILGUN_DOMAIN= MAILGUN_TO= MAILGUN_FROM=
Run The Application
- If you are running the app for the first time, or have recently pulled changes, you should run
- Start the development server with
npm run start:dev
Try The App
Just navigate to commits-to.js:8080 (the
ENV_DOMAIN - must contain the
Seed The Database
Browse (or send a GET request) to
http://commits-to.js:8080/reset which drops all tables
and inserts seed data from the
If you have problems connecting to the application via your browser, check that you have
made the necessary changes to the
/etc/hosts file for the subdomain you are using.
You may also need to flush the DNS cache to ensure those changes are recognized.
On Ubuntu, you can use the name service cache daemon (nscd) to flush the DNS cache.
sudo apt-get install nscd sudo service nscd restart
On MacOS, the command to flush the DNS cache will depend on your exact OS level. See How To Clear Your DNS Cache for detailed recommendations by OS version.
Run Mocha tests with
The structure and naming inside the
test/ folder should mirror the root structure and file names.
Writing code with well-contained classes or functions will be the most straightforward to unit test.
Automatic Heroku Deployment