Quick Start Guide
This guide will get you from installation to finding your first bus route in under 5 minutes.Make sure you’ve completed the Installation Guide before starting this tutorial.
Start the Development Server
React Route Finder uses a concurrent development setup that runs both the Webpack dev server and the Express backend simultaneously.Run the Application
Execute the start command:concurrently --kill-others "npm run dev" "npm run serverDev", which:
- Webpack Dev Server (
npm run dev) - Watches and rebuilds your React code on changes - Express Server (
npm run serverDev) - Runs the API server with auto-restart via nodemon
The
--kill-others flag ensures that if one process fails, the other is terminated automatically.Access the Application
Open your browser and navigate to:- A form with latitude/longitude input fields
- A “Buscar ruta” (Find Route) button
- A Google Map centered on Buenos Aires
Find Your First Route
Understanding the Interface
The application displays three main elements:- Route Form - Input fields for start and destination coordinates
- Map - Interactive Google Maps visualization
- Results - Step-by-step route instructions (appears after search)
Default Coordinates
The application comes with pre-filled coordinates in Buenos Aires: From (Start):- Latitude:
-34.55931882107318 - Longitude:
-58.456907455139174
- Latitude:
-34.58049629262017 - Longitude:
-58.45130747926478
Find a Route
Use default coordinates
The form is pre-filled with valid coordinates. Simply click “Buscar ruta” to find a route.
View the results
After clicking, the application will:
- Send coordinates to the
/routeendpoint - Calculate the optimal bus route
- Display numbered markers on the map
- Show step-by-step instructions
Example Output
After finding a route, you’ll see instructions like:- Numbered markers for each stop
- A blue route line connecting the stops
- Turn-by-turn directions
Make an API Request
You can also interact with the API directly using curl or any HTTP client.POST /route
Find a route between two coordinates:GET /allRoutes
Retrieve all available bus routes and stops:Customize Your Route Search
Enter Custom Coordinates
Enter new coordinates
Input your desired latitude and longitude values. For example:From:
- Lat:
-34.6037 - Lng:
-58.3816
- Lat:
-34.6158 - Lng:
-58.4333
Get Coordinates from Google Maps
To find coordinates for any location:- Open Google Maps
- Right-click on your desired location
- Click the coordinates to copy them
- Paste into the React Route Finder form
Understanding the Algorithm
The route finder uses these parameters:Route Finding Process
Generate possible routes
It explores up to 10,000 possible route combinations through the bus network
Available npm Scripts
Common Issues
No routes found
If you get “No hay rutas disponibles”:- Start location too far - Ensure your start is within 800m of a bus stop
- Destination too far - Ensure your destination is within 800m of a bus stop
- No data loaded - Verify the backend at
http://localhost:8000/branchis returning bus stop data
Map not displaying
Server not starting
- Check if port 8080 is available
- Ensure all dependencies are installed (
npm install) - Check console for error messages
Next Steps
Now that you have React Route Finder running, you can:- Explore the source code to understand the algorithm
- Customize the route-finding parameters in
src/server/FindLogic.js - Integrate your own bus stop data source
- Modify the UI components in
src/client/ - Add new features like favorite routes or route history
The application is built with React 16.3.2 and uses class components. You can modernize it by converting to functional components with hooks.
Development Workflow
Making Changes
- Client Changes - Edit files in
src/client/, Webpack auto-rebuilds - Server Changes - Edit files in
src/server/, Nodemon auto-restarts - Refresh Browser - See your changes immediately
Example: Modify Walking Distance
Editsrc/server/FindLogic.js:
Testing Your Routes
Try these test cases to verify the application works correctly:- Short distance - Set start and destination close together
- Long distance - Set points far apart requiring multiple transfers
- Edge cases - Try coordinates outside the bus network coverage