Motivation for this project is to provide the head start to beginners to build REST API's,using the popular java open source frameworks and necessary configs.They should be able to build and test first webservice within 10 minutes.
JDK :- 1.7
Mysql:- 5.6
Maven:-3.0 or later
Tomcat:- 1.7 or later
1.Clone the project.
2.If maven is setup properly in your system. then you can download all the required dependency and build war using the maven by using below command.
mvn clean package
3.Create DB by running below command.
mysql -h hostname -u user database < path/to/test.sql
4.Change the username and password to your mysql username in context.xml.
5.Go to the target folder and copy the rest.war file and put it in tomcat webapps folder and start the server.
To test the REST API , use any rest client like postman etc.
1.Create product api (sample)
URL :- localhost:8080/rest/api/products/
header :- content-type :- application/json
method :- post
body :- {
"name" : "first product",
"description" : "sample"
}
After hitting this api , new product must be created inside the rest database's product table.
you can check this by firing the sql query on mysql terminal.
2.Get product api (sample)
URL :- localhost:8080/rest/api/products/{id}
provide the id , which you get as a response from create product api , in the url , you will get its all the information.
Un can be execusted using the Unit-tests feature branch.