Реализация RESTfull сервиса "Blogger".

На сайте можно:

  1. Взаимодействовать с аккаунтом. Аккаунт может иметь много постов и комментов.
  2. Взаимодействовать с постами. Пост может иметь много комментариев и одного автора.
  3. Комментировать посты. Комментарий имеет одного автора и привязан к одному посту.

Стек технологий:

Spring Boot, Lombok, Spring Data, Spring Validation, H2 inMemory db.

Build

$ ./mvn clean install -Dmaven.test.skip

$  java -jar target/blogger-service-1.0.2-SNAPSHOT.jar

Curl

-- curl http://localhost:8091/api/accounts/register create account

-- curl http://localhost:8091/api/accounts/1/posts create post

-- curl http://localhost:8091/api/posts/1/comments?author=1 add comment

-- curl http://localhost:8091/api/accounts/1/posts get posts of account

-- curl http://localhost:8091/api/comments/all get comments

Swagger Spec

http://localhost:8091/swagger-ui.html swagger2

H2 console

http://localhost:8091/h2-console h2console

Usage

  $ curl -H "Accept: application/json" POST http://localhost:8091/api/accounts/register create account
{
  "name": "Chris Richardson",
  "email": "chric@pivotal.com",
  "logo": null,
  "social_network": "twitter, vk.com"
}

  $ POST http://localhost:8091/api/accounts/1/posts create post
{
  "name": "Aviation news",
  "slugs": "tech",
  "content": "description",
  "views": 28
}

$ POST http://localhost:8091/api/posts/1/comments?author=1 add comment
{
  "content": "You rock",
  "likeCount": 6
}


$ GET http://localhost:8091/api/accounts/1/posts get posts of account

$ GET http://localhost:8091/api/posts/all

$ GET http://localhost:8091/api/comments/all get comments