Skip to content

DFanso/java-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java REST API with JAX-RS

Build and Run

Option 1 - Using Jetty (Recommended for Development)

mvn clean jetty:run

Option 2 - Build WAR file

mvn clean package

The WAR file will be created in the target directory. Deploy it to your favorite Java application server (Tomcat, WildFly, etc.).

Test the API

Health Check

curl http://localhost:8000/api/health

Get All Users

curl http://localhost:8000/api/users

Get User by ID

curl http://localhost:8000/api/users/1

Create User

curl -X POST http://localhost:8000/api/users \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"john@example.com"}'

Update User

curl -X PUT http://localhost:8000/api/users/1 \
  -H "Content-Type: application/json" \
  -d '{"name":"John Updated","email":"john.updated@example.com"}'

Delete User

curl -X DELETE http://localhost:8000/api/users/1
mvn clean
mvn install
mvn jetty:run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages