Skip to content

Usage and Installation

Gregory Presser edited this page May 11, 2022 · 3 revisions

Usage and Installation

Pre-requisite

  • Java version 17 (I used 17.0.2)
  • Maven Version 3.8.5 (Maven version 3.8.4 and lower will most likely not work )
  • node version 17.7.2
  • npm version 8.5.2
  • A Google Client ID and API KEY which allows for
    • When getting the client ID make sure to make an OAuth Consent Screen with userinfo.email userinfo.profile and openid as allowed scopes
    • Make sure http://localhost:3000 is added as an authorized JavaScript Origin and http://localhost:4567/login is allowed as an authorized JavaScript redirect
    • The following APIs need to be enabled
      • Directions API
      • Places API
      • Geocoding API
      • Maps Javascript API
  • A Mapbox API key https://account.mapbox.com/

Run the Backend

Env variables needed

  • GOOGLE_CLIENT_ID
  • MONGO_URI
  • GOOGLE_API_KEY

Building the project

I recommend using a build script and run script
build.sh should be put in the TrekEngine-Service folder and contain

export GOOGLE_CLIENT_ID="<GOOGLE_CLIENT_ID>"
export MONGO_URI="<MONGO_URI>"
export GOOGLE_API_KEY="<GOOGLE_API_KEY>
mvn clean install

run.sh should be put in the TrekEngine-Service folder and contain

export GOOGLE_CLIENT_ID="<GOOGLE_CLIENT_ID>"
export MONGO_URI="<MONGO_URI>"
export GOOGLE_API_KEY="<GOOGLE_API_KEY>
java -jar target/TrekEngine-Service-1.0-SNAPSHOT-jar-with-dependencies.jar

make sure to chmod +x build.sh and chmod +x run.sh before trying to run

Finally to build the Jar

  1. Run build.sh with ./build.sh which should first run all the Unit Tests then build the Jar
  2. Run run.sh with ./run.sh which should start the backed service

#Run the Frontend

  • add the env.js file in the trek-engine-app/src/ folder which should contain
const env = {
	GOOGLE_CLIENT_ID:"<GOOGLE_CLIENT_ID>",
	MAP_BOX_ACCESS_TOKEN:"<MAP_BOX_ACCESS_TOKEN>"
}; 

export default env; 
  • run cd trek-engine-app
  • run npm install or npm i
  • run npm start
Clone this wiki locally