-
Install Required Extensions:
- Open VS Code
- Install "Extension Pack for Java" by Microsoft
- Install "Spring Boot Extension Pack" by VMware
-
Open and Run:
- Open the
SpringBootRestAPIfolder in VS Code - Navigate to
src/main/java/com/geospatial/GeospatialAnalysisApplication.java - Click the "Run" button that appears above the
mainmethod - Or press
F5to debug
- Open the
-
Verify:
- Look for "Started GeospatialAnalysisApplication" in the terminal
- Application runs on: http://localhost:8080
Prerequisites: Java 17+ and Maven must be installed (see SETUP.md)
cd /Users/pritikavipin/Documents/SpringBootRestAPI
# Build and run
mvn spring-boot:run- Open IntelliJ IDEA
- File → Open → Select
SpringBootRestAPIfolder - Wait for Maven import
- Right-click
GeospatialAnalysisApplication.java→ Run
# Test if API is running
curl http://localhost:8080/api/regions
# You should see sample data with 3 regions# Make sure application is running first!
cd /Users/pritikavipin/Documents/SpringBootRestAPI
./test-api.shcurl http://localhost:8080/api/regionscurl -X POST http://localhost:8080/api/regions \
-H "Content-Type: application/json" \
-d '{
"name": "Tech Park",
"latitude": 37.4419,
"longitude": -122.1430,
"description": "Innovation center"
}'curl -X POST http://localhost:8080/api/signals \
-H "Content-Type: application/json" \
-d '{
"regionId": 1,
"indicatorType": "TECH_INVESTMENT",
"score": 95.0,
"description": "High tech investment"
}'curl http://localhost:8080/api/hotspots?limit=5All API responses follow this format:
{
"success": true,
"message": "Success message",
"data": { ... }
}The application comes pre-loaded with:
- 3 Regions: Silicon Valley, Downtown District, East Bay
- 7 Signals: Various growth indicators across regions
H2 Console: http://localhost:8080/h2-console
Connection details:
- JDBC URL:
jdbc:h2:mem:geospatialdb - Username:
sa - Password: (leave empty)
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/regions | Get all regions |
| POST | /api/regions | Create region |
| GET | /api/regions/{id} | Get region by ID |
| PUT | /api/regions/{id} | Update region |
| DELETE | /api/regions/{id} | Delete region |
| GET | /api/signals | Get all signals |
| GET | /api/signals?regionId={id} | Get signals by region |
| POST | /api/signals | Create signal |
| GET | /api/signals/{id} | Get signal by ID |
| PUT | /api/signals/{id} | Update signal |
| DELETE | /api/signals/{id} | Delete signal |
| GET | /api/hotspots?limit={n} | Get top N hotspots |
- Open Postman
- Click Import
- Select
Geospatial-API.postman_collection.json - All endpoints will be ready to test!
Application won't start?
- Check if Java 17+ is installed:
java -version - Check if port 8080 is available:
lsof -i :8080
See SETUP.md for detailed installation instructions
- Explore the code in
src/main/java/com/geospatial/ - Modify
DataInitializer.javato add your own sample data - Check README.md for detailed API documentation