Keeping the world on track with TrainTrack!
Live link: traintrack.me
Install mongodb locally (Mac):
brew tap mongodb/brew
brew install [email protected]
To run mongodb once:
mongod --config /usr/local/etc/mongod.conf
To automatically run mongodb after login::
brew services start mongodb/brew/[email protected]
We use direnv to autoload exported secrets from .envrc
file, each time you enter in this project's folder.
Run direnv allow
after each time secrets are changed in .envrc
(development secrets only).
All functions are compiled with webpack using the Babel Loader, so you can use modern JavaScript, import npm modules, etc., without any extra setup.
Before developing, clone the repository:
git clone https://github.com/Ledgy/TrainTrack
Navigate into the newly created TrainTrack directory, and run:
brew install yarn
brew install netlify-cli
npm install
To start your app server, run:
export REACT_APP_MAPS_KEY=662607015
netlify dev
This will open a local server running at http://localhost:3000
with your app
Install netlify
client:
npm install netlify-cli -g
To run both lambda functions and the app dev server:
netlify dev
From inside the project folder, run yarn
to install all dependencies and then:
yarn start:lambda
This will open a local server running at http://localhost:9000
serving your Lambda functions, updating as you make changes in the src/lambda
folder.
You can then access your functions directly at http://localhost:9000/{function_name}
, but to access them with the app, you'll need to start the app dev server.
While the functions server is still running, open a new terminal tab and run:
yarn start
This will start the normal create-react-app dev server and open your app at http://localhost:3000
.
Local in-app requests to the relative path /.netlify/functions/*
will automatically be proxied to the local functions dev server.
Make sure, that all required servers are running as outlined above. To test the
login callback you can then run the following. Please note, that netlify
does
not fully mock the user metadata yet.
netlify functions:invoke --name identity-login --identity