Skip to content

msndie/Restful

Repository files navigation

Restful

Goal of this project is to learn how to use Spring mechanisms to develop REST applications.

Schema
Api
Adoc

In this project we use:

  • Rest Controllers
  • Spring security (OAuth2 server) in ex01 and ex02 for JWT role based auth. GET operations are available for user with any role, but POST, PUT and DELETE only for ADMIN
  • Hibernate
  • Spring Data Jpa
  • Spring Data Rest in ex02
  • Swagger
  • Mockito and Jupiter for tests

Launch

You need to create an empty database in postgres.

Write your credentials in application.properties file in each EX.

Then you can just use the following command to run the application

./mvnw clean spring-boot:run

Now service available on http://localhost:8080. To access it in ex01 and ex02 you need to get JWT token first. To do so you need to send POST request with following information on http://localhost:8080/#

{
  "login": "admin",
  "password": "123QWEasd"
}

This way you get your token, you need to add it in Authorization header with each request. You can find available mappings on http://localhost:8080/swagger-ui/ page for ex00 and ex01. For ex02 you can use HAL browser. Auto-generated snippets based documentation for course publish method can be found on http://localhost:8080/docs/publish

Releases

No releases published

Packages

No packages published

Languages