Giter Site home page Giter Site logo

chriscarleton / divelog Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 1.3 MB

An online scuba diving log book

Home Page: https://www.bottomtime.ca/

License: Apache License 2.0

JavaScript 60.98% Shell 0.21% HTML 0.30% CSS 38.50%
scuba diving logbook log book

divelog's Introduction

Bottom Time

Circle CI build: CircleCI

Code Coverage: Coverage Status

Dependencies: dependencies Status

Security: NSP Status

An online scuba diving log book.

Developing Against Bottom Time.

See the API documentation here.

Building and Testing Locally

Prerequisites

  • You must have Node.js v8.4.0 or higher installed.
  • You must have Docker installed to run the fake DynamoDb module.
  • You must have Gulp installed globally. (Run npm i -g gulp.)
  • It's also a good idea to have Bunyan installed globally for viewing log output. (npm i -g bunyan.)

Preparing a Development Environment

From the project directory simply run:

./deploy/setup-local.sh

This will run the fake DynamoDb Docker image and provision it with the tables necessary for testing and development. Now the project's integration tests will run and you can begin developing locally.

Tearing Down a Development Environment

To stop and remove the previously created Docker containers run

./deploy/teardown-local.sh

The Mail Client

Some functions of the application involve the sending of templated e-mails. In order for the app's mail client to work, certain environment varialbes need to be set.

  • DIVELOG_MAIL_FROM_ADDRESS - The address from which e-mail messages from the app will appear to originate from.
  • DIVELOG_MAIL_HOST - The host name or URL of the SMTP server that will deliver the app's mail messages.
  • DIVELOG_MAIL_PORT - The port number on which the SMTP host listens for connections.
  • DIVELOG_MAIL_USERNAME - The username to use when authenticating with the SMTP server.
  • DIVELOG_MAIL_PASSWORD - The password to use when authenticating with the SMTP server.

Testing the Mail Client

To test to see if the e-mail client is configured correctly, there is a test script that can be run.

node deploy/mail-test.js <destination>

The script will invoke the app's mail client to send a test e-mail to the address specified as <destination>.

Common Gulp Tasks

Run unit tests:

gulp test

Lint the code:

gulp lint

Bundle the web components (WebPack):

gulp bundle

Run the dev server (see below for more information):

npm run dev

Dev Server

To facilitate local development you can run the app in the dev server, which is powered by gulp-live-server. Gulp will monitor all .js and .pug files in the service/ directory and restart the server upon any changes so that you can continue making changes and the server will keep the running app current.

The dev server uses a locally-running, in-memory version of DynamoDb for its data store. You will need to make sure it's running before starting the dev server. See the section above on Preparing a Dev Environment.

Additionally, Webpack Dev Server is used to serve the front end Javascript to the browser. This gives us React hot reloading of modules which means the server should not need to be restarted to immediately show front-end changes in the browser.

To start the dev server you can run

npm run dev

Generating Test Data

Run the following command

npm run test-data

To generate some random test data and inject it into the dev server database. You will get several users (including one admin user) and roughly 1000 dive log entries.

divelog's People

Contributors

chriscarleton avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

gaydivebuddy

divelog's Issues

What's with the glyphs?

The glyph icons are suddenly looking messed up. Get to the bottom of that and get them looking normal again.

Make the map useful

Users should be able to click on the map to set the dive site's GPS coordinates. That way the map isn't just a pretty thing to look at. Also, it would be nice if the map auto-centered on the user's current location (browser location services?)

Control labels are not right-aligned!

This makes for some weirdness. When the text is long enough to wrap, the control labels will be right-aligned. When the text is not long enough, they will be left-aligned. It's gross. Please fix.

Handle session destruction better

When users log out or their sessions expire we should be terminating the session in the UI:

  • Redirect to home page if the user is on a page that requires auth.
  • Purge potentially sensitive data from the Alt stores.

Sanitize user information before returning in APIs.

Make sure sensitive user information is stripped before it is returned from any APIs. APIs that return a user entity right now are:

  • Login
  • Sign up
  • The "me" API.
  • Possibly more...

Standardize this goodness. Never return the raw req.user object!!

Require SSL

Find a way to ensure that requests over HTTP are redirected to HTTPS (without breaking health checks or the ELB, etc.)

Deployment to Prod Fails

Modifications need to be made to divelog.yml. Deploying a production stack fails due to conflicting resource names. :(

Some resources (e.g. load balancers) etc. will need stack-specific names like the dynamo tables have.

Discard Changes button

Discard Changes button on dive entries page. Not sure this works properly. Double-check it.

Colon wraps on Sign Up page

The colon of ControlLabel of the retype password field on the sign up page wraps to another line and looks dumb. Pls fix.

Errors being dumped to the browser!!

This gets rendered to the browser when I kill the database on my dev server:

Error: connect ECONNREFUSED 127.0.0.1:7777
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)

Definitely need to handle this more gracefully!!

Protect Session Secret

Make the Express session secret configurable so that it can be injected into the environments at run time. It's not safe to have it in source control - session hijacking, man!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.