The project is configured to use an in-memory H2 database that is volatile. If you wish to make it maintain data on application shut down, you can change the spring.database.jdbc-url to point at a file like jdbc:h2:file:/{your file path here}
- With the IDE run the
RmmApplicationclass - With command line type
./gradlew bootRun
In order to perform requests, you need to authenticate. This application uses JWT tokens with Spring Security.
With a rest client like Postman or Insomnia, or curl, do a POST request to:
localhost:8080/login
With the request body:
{
"username" : "dev",
"password" : "dev"
}Get the JWT token and use it as a Bearer Authorization header, like:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZXYiLCJleHAiOjE2NjcwNzUyOTF9.8kYo3O86OXxvpIM773JLtnuAlQgmfY-oAJghvqkeKxrkHIwG-rlV7vNr_jxid6CvKYkRKb5lLxkcI5wLJl_klA
Go to: http://localhost:8080/swagger-ui/index.html
In order to use Swagger UI you need to provide the auth token. In the swagger home, click Authorize:

Then, type the auth token with the prefix Bearer and click Authorize:

You should be able to use the endpoints for Devices and Services.
In order to see and interact with your db, access the h2 console in your browser. After running the application, go to:
http://localhost:8080/h2-console
Enter the information for the url, username, and password in the application.yml:
url: jdbc:h2:mem:localdb
username: sa
password: passwordYou should be able to see a db console now that has the Sample Repository in it.
Type:
SELECT * FROM DEVICE;Click Run, you should see two rows, for ids 1 and 2
Feel free to remove or repurpose the existing Sample Repository, Entity, Controller, and Service.