lcopeland001 / prime-aquatics-empowered

3 stars 0 forks source link

Aquatics Empowered

This app uses React, Redux, Express, Passport, SweetAlert2 and PostgreSQL (a full list of dependencies can be found in package.json).

We STRONGLY recommend following these instructions carefully. It's a lot, and will take some time to set up, but your life will be much easier this way in the long run.

Features

Known Bugs

Unimplemented Features

Prerequisites

Before you get started, make sure you have the following software installed on your computer:

Create database and table

Create a new database called aquatics_empowered and copy data in database.sql

Development Setup Instructions

Debugging

To debug, you will need to run the client-side separately from the server. Start the client by running the command npm run client. Start the debugging server by selecting the Debug button.

VSCode Toolbar

Then make sure Launch Program is selected from the dropdown, then click the green play arrow.

VSCode Debug Bar

Testing Routes with Postman

To use Postman with this repo, you will need to set up requests in Postman to register a user and login a user at a minimum.

Keep in mind that once you using the login route, Postman will manage your session cookie for you just like a browser, ensuring it is sent with each subsequent request. If you delete the localhost cookie in Postman, it will effectively log you out.

  1. Start the server - npm run server
  2. Import the sample routes JSON file v2 by clicking Import in Postman. Select the file.
  3. Click Collections and Send the following three calls in order:
    1. POST /api/user/register registers a new user, see body to change username/password
    2. POST /api/user/login will login a user, see body to change username/password
    3. GET /api/user will get user information, by default it's not very much

After running the login route above, you can try any other route you've created that requires a logged in user!

Production Build

Before pushing to Heroku, run npm run build in terminal. This will create a build folder that contains the code Heroku will be pointed at. You can test this build by typing npm start. Keep in mind that npm start will let you preview the production build but will not auto update.

Lay of the Land

Directory Structure:

This code is also heavily commented. We recommend reading through the comments, getting a lay of the land, and becoming comfortable with how the code works before you start making too many changes. If you're wondering where to start, consider reading through component file comments in the following order:

Deployment

  1. Create a new Heroku project
  2. Link the Heroku project to the project GitHub Repo
  3. Setup a database with Bit.io
  4. Create the necessary tables
  5. Link the Bit.io database to the Heroku project
  6. Add an environment variable for SERVER_SESSION_SECRET with a nice random string for security
  7. In the deploy section, select manual deploy