This is a spring boot framework learning repository based on the tutorial from AmigoCode. It contains a simple API configured using spring boot. You are able to perform standard GET, PUT, POST and DELETE request with this application against a Student table setted up with PostgreSQL.
-
Clone this repository from github to install:
git clone https://github.com/chunyuema/spring-boot-api.git
-
Download and set up PostgreSQL locally
-
Open the project with IntelliJ
-
Run the Main class to start the server
-
You can also use the Maven build tool (Maven -> Install) from the IntelliJ to generate the jar file
java -jar spring-boot-api-0.0.1-SNAPSHOT.jar
Use Postman to test the API
-
GET:
localhost:8080/api/v1/student/
-
POST:
localhost:8080/api/v1/student/
with a request body as follows
{ "name": "alex", "email": "alex@gmail.com", "dob": "1995-12-17" }
-
DELETE:
localhost:8080/api/v1/student/{studentId}
-
PUT:
localhost:8080/api/v1/student/{studentId}?name={new_name}&email={new_email}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.