Skip to content

A RESTful API with JAX-RS. This repo containes one dockerfile in order to spin up a container.

Notifications You must be signed in to change notification settings

mixaverros88/dockerized-java-api

Repository files navigation

Quality Gate Status Build Status preview image preview image preview image preview image Known Vulnerabilities

RESTful APIs with JAX-RS

preview image

Docker Instructions

preview image You can run the dockerRun.sh in order to spin up a docker container.

curl -LOk https://github.com/mixaverros88/java-api/raw/master/target/demorest.war

Spin up the container.

docker run -it -p 80:8080 -v /$(pwd):/usr/local/tomcat/webapps mixaverross88/java-restfull-api:1.1

Or run the compose file.

docker-compose up

Navigate to the following link.

[docker-machine ip]:80/demorest/

See the docker file in the Docker Hub

https://hub.docker.com/r/mixaverross88/java-restfull-api

Status codes for CRUD operations

Operation URI Method Success/Failure Status Code
Get Message messages/{messageId} Get Success 200
Not found 404
Failure 500
Delete Message messages/{messageId} Delete Success 200 or 204
Not found 404
Failure 500
Edit Message messages/{messageId} Put Success 201
Wrong Format data 400 or 415
Not found 404
Failure 500
Create Message messages Post Success 201
Wrong Format data 400 or 415
Not found 404
Failure 500

💻 Deploy instructions

Use the maven plug-in (tomcat7-maven-plugin) for tomcat server in order to automatically deploy this project in your local server. You can find this plug-in in pom.xml file in order to modify with yours configurations, also don't forget to add in settings.xml your credentials for tomcat server.

<servers>
    <server>
        <id>TomcatServer</id>
        <username>admin</username>
        <password>password</password>
    </server>
</servers>

You can run the below command in order to deploy the artifact in your local tomcat server

mvn clean tomcat7:deploy

This rest api follows the Richardson Maturity Model

preview image

  1. Resource URI (Individual URIs for each resource)
  2. HTTP Methods (GET, POST, PUT, DELETE)
  3. HATEOAS (Responses have links that the clients can use)

Postman Collection

preview image You can find in postman folder a json to run tests via newman.

Jenkins

You are able to use Jenkinsfile in order to create pipe line for jenkins.