Spring Boot REST APIs for managing GeoJSON details.
- Java 8
- Apache Maven
- MongoDB
Please follow the instructions in the links below based on your OS
Modify /etc/hosts file for Linux/macOS to add mongodb as an alias for 127.0.0.1
The updated file should look like as follows:
$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost mongodb
::1 localhost6.localdomain6 localhost6
For Windows, please refer to the Windows documentation to change the hosts file.
Connect to mongo:
mongo --host 127.0.0.1:27017
Create a user:
use devapps
db.createUser(
{
"user": "mongouser",
"pwd": "mongopass",
"roles": [
{ "role": "readWrite", "db": "devapps" }
]
}
)
Run the following command to create a text index to search by searchable text:
use devapps
db.spatial.createIndex( { "properties.searchableText" : "text" } )
mongoimport --jsonArray --db devapps --collection spatial --drop --file sample-data/devAppsGeoJsonData.json
mongoimport --jsonArray --db devapps --collection devapp --drop --file sample-data/devAppsData.json
mvn clean install
Navigate to the gis-service
directory, then run:
java -jar target/gis-service-1.0.0-SNAPSHOT.jar
mvn spring-boot:run
Unit tests will be executed during the test
lifecycle phase and will run as part of any maven goal after test
.
mvn package
To access the application, open the following link in your browser:
http://localhost:8080
To access the Springboot actuator endpoints, open the following link in your browser:
health
http://localhost:8081/actuator/health
info
http://localhost:8081/actuator/info