Employee REST API using Dropwizard 1.0.5
Java 8 needed to run this code.
Dropwizard is an open source Java framework for developing REST APIs.
Libraries using from Dropwizard:
-
- Jetty for serving an HTTP server inside this project'.
-
- Jersey for developing RESTful Web Services in Java'.
-
- Jackson for objects to/from JSON conversion'.
Using Hibernate features for the database.
To test the example application run the following commands.
-
To package the example run.
mvn package -
To setup the h2 database run.
java -jar target/DropwizardEmployee-1.0.5.jar db migrate example.yml -
To run the server run.
java -jar target/DropwizardEmployee-1.0.5.jar server example.yml -
To post data into the application.
curl -H "Content-Type: application/json" -X POST -d '{"firstName":"Mayur", "lastName":"Chougule","jobTitle":"Software Engineer"}' http://localhost:8080/employee
-
To view the list of employees.