This version uses React to control the login requests and redirection in coordination with client-side routing.
We STONGLY 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.
Before you get started, make sure you have the following software installed on your computer:
Create a new database called prime_app and create a person table:
CREATE TABLE person (
id SERIAL PRIMARY KEY,
username VARCHAR (80) UNIQUE NOT NULL,
password VARCHAR (1000) NOT NULL
);If you would like to name your database something else, you will need to change prime_app to the name of your new database name in server/modules/pool.js
- Don't Fork or Clone. Instead, click the
Clone or Downloadbutton and selectDownload Zip. - Unzip the project and start with the code in that folder.
- Create a new GitHub project and push this code to the new repository.
- Run
npm install - Create a
.envfile at the root of the project and paste this line into the file:While you're in your newSERVER_SESSION_SECRET=superDuperSecret.envfile, take the time to replacesuperDuperSecretwith some long random string like25POUbVtx6RKVNWszd9ERB9Bb6to keep your application secure. Here's a site that can help you: https://passwordsgenerator.net/. If you don't do this step, create a secret with less than eight characters, or leave it assuperDuperSecret, you will get a warning. - Start postgres if not running already by using
brew services start postgresql - Run
npm run server - Run
npm run client - Navigate to
localhost:3000
To debug, you will need to run the client-side separately from the server. Start the client by running the command npm run dev:client. Start the debugging server by selecting the Debug button.
Then make sure Launch Program is selected from the dropdown, then click the green play arrow.
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.
- Start postgres if not running already by using
brew services start postgresql - Run
npm start - Navigate to
localhost:5000
src/contains the React applicationpublic/contains static assets for the client-sidebuild/after you build the project, contains the transpiled code fromsrc/andpublic/that will be viewed on the production siteserver/contains the Express App
- Create a new Heroku project
- Link the Heroku project to the project GitHub Repo
- Create an Herkoku Postgres database
- Connect to the Heroku Postgres database from Postico
- Create the necessary tables
- Add an environment variable for
SERVER_SESSION_SECRETwith a nice random string for security - In the deploy section, select manual deploy

