Skip to content

sja26/number-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Number Service

System requirements

Initial Setup

  1. $ heroku login
  2. $ heroku create

Postgres database (Local)

  1. Open a psql prompt #

  2. Create a new database

    # CREATE DATABASE your_db_name;

  3. Create a new user

    # CREATE USER your_user_name WITH PASSWORD 'your_user_password';

  4. Change the owner of the new database to the new user

    # ALTER DATABASE your_db_name OWNER TO your_user_name;

  5. Open a terminal prompt $

  6. Set the DATABASE_URL environment variable to store the database connection information (note: this includes credentials).

    $ export DATABASE_URL="host=localhost dbname=your_db_name user=your_user_name password=your_user_password"

Postgres database (Cloud)

  1. Provision the Heroku Postgres add-on, this will set the DATABASE_URL environment variable.

    $ heroku addons:create heroku-postgresql:hobby-dev

Running

Local

  1. $ pipenv install install dependency graph
  2. $ pipenv shell activate project's virtualenv
  3. $ make local run web app locally

Cloud

  • $ make deploy git push branch master to remote heroku
  • $ make start start service
  • $ make stop stop service
  • $ heroku logs --tail view logs

Usage

Quick happy path

  1. Initialize the service /init. One admin user is created with user id admin and password password.
  2. Change the default admin password /user/password/change
  3. Refresh admin auth token /user/auth_token/refresh
  4. Add a user /user/add
  5. Add a number /number/add
  6. Add the user to the number /number/user/add
  7. Get next number /number/next

See Postman collection for more detail and complete list of endpoints.

Testing

Set the TEST_DATABASE_URL environment variable to store the database connection information (note: this includes credentials).

  • $ make test run tests
  • $ make testcov run tests and generate coverage report

License

Apache License 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published