This is a FullStack React App built at CUNYTechPrep by teamTickToFix
Each team member will need to do this on their local machine.
Create a user in postgres named ctp_user
with the password ctp_pass
:
This only needs to be done one time on your machine You can create additional users if you want to.
sudo service postgresql start
createuser -P -s -e ctp_user
Create a separate db for this project:
createdb -h localhost -U ctp_user app2019_development
You will create a DB for each project you start based on this repo. For other projects change
app2019_development
to the new apps database name.
For more details see this installing postgres guide
For local development you will need two terminals open, one for the api-backend and another for the react-client.
Clone this app, then:
# api-backend terminal 1
cp .env.example .env
npm install
## start the postgresql service
sudo service postgresql start
npm run dev
# react-client terminal 2
cd client
npm install
npm start
- api-backend will launch at: http://localhost:8080
- react-client will launch at: http://localhost:3000
In production you will only deploy a single app. The react client will build into static files that will be served from the backend.
Install the heroku cli if you don't already have it.
You will also need a heroku account And this will only be done once on your machine
# on mac
brew install heroku/brew/heroku
heroku login
Next, cd
into this project directory and create a project:
heroku create cool-appname
heroku addons:create heroku-postgresql:hobby-dev
This will deploy your apps to https://cool-appname.herokuapp.com, assuming that it is not taken already.
You only need to do this once per app
Whenever you want to update the app run this command.
git push heroku master
This command deploys your master branch. You can change that and deploy a different branch such as:
git push heroku development