Skip to content
/ plantapp Public
forked from hillscottc/plantapp

A React app with a Postgres db for Plants data from USDA

Notifications You must be signed in to change notification settings

rad73/plantapp

 
 

Repository files navigation

plantapp

See this running on Heroku at https://plantapp.herokuapp.com/

Project structure

Install

$ git clone https://github.com/hillscottc/plantapp
$ cd plantapp
$ npm install
  • Note: The client project is independent of the server project. So a postinstall script is added to run npm install on the client dir as well. In package.json, you see:
      "scripts": {
        "postinstall": "cd client && npm install"
    

Run

$ npm start

This launches the Server and Client with foreman.

The services can also be run individually. For example to run just the server:

$ npm start:server

Or, with foreman:

$ nf start server=1

Using node-foreman

node-foreman provides several benefits. In this project, it is used primarily for two things:

  1. Configure our client (React) service and server (Express) processes. This is done in the Procfile:

    web: npm run start:client
    server: npm run start:server
    
  2. Configure environment variables read by at launch. This is done with a .env file:

    {
      "node": {
        "env": "development"
      },
      "mongo": {
        "url": "mongodb://localhost/plantsdb"
      },
      "server": {
        "port": 3001
      }
    }

    Then these variables can be accessed from javascript like: process.env.MONGO_URL.

About

A React app with a Postgres db for Plants data from USDA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.3%
  • HTML 5.0%
  • CSS 3.7%