- Server using port 8081, so make sure it's free.
- Also, application using PostgreSQL, with liquibase script, which one allows you to create mandatory tables and fill them with columns.
- Just run bootRun in gradle sidebar.
- Application using swagger-ui, so you can go to Swagger after server start up and check what you can do.
- You should use authorize endpoint first, so you get JWT token which one you need to use for other endpoints. Note that before the token in the bearerToken field you should add "Bearer_" prefix(after "Bearer" there is underscore).
In case of using docker just run docker-compose up command
Put "/users" - create new user and add him to DB
Post "/message" - Add new message according to username
Get "/message/history/{amount}" - Get {amount} number of messages from DB, according to username
Post "/authorize" - Authenticate user and generate JWT token
- Java 17
- Spring Boot
- Spring Security
- Spring OpenAPI
- Swagger
- JUnit, Mockito
- PostgreSQL, Liquibase
- Lombok
- Mapstruct
- HikariCP
- JJWT
-
Create new user with unique name:
$ curl -X 'PUT'
'http://localhost:8081/users'
-H 'accept: */*'
-H 'Content-Type: application/json'
-d '{
"name": "your name",
"password": "your password"
}' -
Authorize user:
$ curl -X 'POST'
'http://localhost:8081/authorize'
-H 'accept: */*'
-H 'Content-Type: application/json'
-d '{
"name": "your name",
"password": "your password"
}' -
Save message to DB:
$ curl -X 'POST'
'http://localhost:8081/message'
-H 'accept: */*'
-H 'bearerToken: past bearerToken from Authorize endpoints response here'
-H 'Content-Type: application/json'
-d '{
"name": "your name",
"message": "your message"
}' -
Get messages from DB:
$ curl -X 'GET' 'http://localhost:8081/message/history/{amount}?userName=userName&amount=2'
-H 'accept: */*'
-H 'bearerToken: past bearerToken from Authorize endpoints response here'