sample spring boot app to understand directory structer and creating an app with mysql as the database backend
run a mysql server on your host ( use a container otherwise)
mysql> create database topics; -- Creates the new database
mysql> create user 'springuser'@'%' identified by 'ThePassword'; -- Creates the user
mysql> grant all on topics.* to 'springuser'@'%'; -- Gives all privileges to the new user on the newly created
now you are all set to run this application
git clone https://github.com/ArjunDandagi/topic-application
cd topic-application
mvn clean install # you can just download dependency also using mvn dependency:resolve
mvn spring-boot:run
now go to http://localhost:8080/hello
to make sure app is good
#CRUD
curl -H "Content-type: Application/json" -X POST http://localhost:8080/topics -d '{"id":"java","name":"java","description":"java is awesome"}'
curl -H "Content-type: Application/json" -X GET http://localhost:8080/topics
curl -H "Content-type: Application/json" -X GET http://localhost:8080/topics/java
if you ask for a topic whose id doesn't exist . it will throw an error 😄
curl -H "Content-type: Application/json" -X PUT http://localhost:8080/topics/java -d '{"id":"java","name":"java","description":"java and maven is awesome"}'
curl -H "Content-type: Application/json" -X DELETE http://localhost:8080/topics/java