Skip to content

data-creative/express-robots

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robots App

Contributing

Prerequisites

Install node and npm.

Install postgresql.

Install source code.

git clone [email protected]:s2t2/express-robots.git
cd express-robots/
npm install

Create database user.

psql
CREATE USER robot WITH ENCRYPTED PASSWORD 'r0b0t!';
ALTER USER robot CREATEDB;
ALTER USER robot WITH SUPERUSER;
\q

Create database.

psql -U robot --password -d postgres -f $(pwd)/db/create.sql

Migrate database.

knex migrate:latest --knexfile db/config.js

Seed the database.

knex seed:run --knexfile db/config.js

Usage

Start the server and visit localhost:3000 in a browser.

DEBUG=robots_app:* npm start

Deploying

Set environment variable(s). Setting NODE_ENV is technically unnecessary because heroku does it automatically during deploy.

heroku config:set NODE_ENV=production SESSION_SECRET=s0m3l0ngstr1ng123456

Ensure postgresql addon is installed.

heroku addons:create heroku-postgresql:hobby-dev

Deploy.

git push heroku master

Create, migrate, and seed production database (NOTE: this is already happening as post-installation scripts in package.json).

heroku pg:reset DATABASE
heroku run NODE_ENV=production knex migrate:latest --knexfile db/config.js
heroku run NODE_ENV=production knex seed:run --knexfile db/config.js

About

A Node.js MVC app configured to use Express and PostgreSQL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.7%
  • CSS 1.3%