This portion of the project is to process tree data. TreeTracker's Admin Panel Frontend and RESTful API built with loopback.
See Wiki for more info on goals
Add Please add any missing content to this readme.
- Install Node
- on OSX , install git and type
brew install git
- on OSX, install home brew and type
brew install node
- on Windows, use the installer available at nodejs.org
- On OSX you can alleviate the need to run as sudo by following John Papa's instructions
- on OSX , install git and type
- Open terminal
- Go to a folder where you would like to install the project. Then type the following:
git clone https://github.com/Greenstand/treetracker-admin.git
- Once cloned type:
cd treetracker-admin/server && touch src/datasources/treetracker.datasource.json && npm install
-
In
server/src/datasources/
directory you will need to create atreetracker.datasource.json
file that will be used to reference the source of data for Loopback. -
Contact the #admin-panel channel on Slack to get our shared treetracker.datasource.json.
We provide a development environment through docker that can run on your local environment.
To run docker on a local machine, you will have to install Docker first. Docker is a linux container technology, so running it on Mac or Windows requires an application with an attached linux VM. Docker provides one for each OS by default.
Install Docker for Mac using homebrew, using the following command
$ brew cask install docker
You can alternatively install Docker via: [Docker for Mac] (https://docs.docker.com/docker-for-mac/install/)
Once Docker is installed, lauch Docker from the Applications GUI.
To install on linux, you can run sudo apt-get install -y docker-ce
but there is additional setup to verify keys, etc.
Install Node (see Requirements above)
Clone this repository
git clone [email protected]:Greenstand/treetracker-admin.git
cd treetracker-admin
Run the setup script. This script installs node modules, builds docker containers, and starts them
./dev/scripts/setup.sh
You can now view the treetracker admin at http://localhost:8080.
It may take a few seconds for the web and api servers to come up. You can monitor them using the docker logs commands as:
docker logs -f treetracker-admin-web
docker logs -f treetracker-admin-api
Also see *Scripts* below
The REST API documentation can be viewed and explored by visiting http://localhost:3000/explorer
To stop the dev environment use
./dev/scripts/down.sh
To start the dev environment back up use
./dev/scripts/up.sh
Just edit as you normally would to view changes in your development environment.
On Windows the easiest way to develop and debug Node.js applications is using Visual Studio Code. It comes with Node.js support out of the box.
https://code.visualstudio.com/docs
Run the following command to start the REST API.
$ npm run start
Run the following command to run the linter.
$ npm run lint
Useful scripts are contained in /dev/scripts. Their uses are described here. Scripts are run from the repository root as /dev/scripts/{script-name}.sh
install.sh install or update npm modules for server and client projects
build.sh build docker images
up.sh bring up docker containers in docker as described by docker-compose.yml
setup.sh run install.sh, build.sh, and up.sh
down.sh bring down docker containers
logs-api.sh show logs for api server
logs-web.sh show logs for React.js dev server
docker-clear-images.sh clear out all docker images
docker-remove-containers.sh clear out all docker containers