diff --git a/README.md b/README.md new file mode 100644 index 0000000..3113b40 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# ![RealWorld Example App using Kotlin and Spring](example-logo.png) + +> ### Spring boot + MyBatis codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld-example-apps) spec and API. + +This codebase was created to demonstrate a fully fledged fullstack application built with Spring boot + Mybatis including CRUD operations, authentication, routing, pagination, and more. + +For more information on how to this works with other frontends/backends, head over to the [RealWorld](https://github.com/gothinkster/realworld) repo. + +# How it works + +The application uses Spring boot (Web, Mybatis). + +# Security + +Integration with Spring Security and add other filter for jwt token process. + +The secret key is stored in `application.properties`. + +# Database + +It uses a H2 in memory database (for now), can be changed easily in the `application.properties` for any other database. + +# Getting started + +You need Java installed. + + ./gradlew bootRun + open http://localhost:8080 + +# Help + +Please fork and PR to improve the code. \ No newline at end of file diff --git a/example-logo.png b/example-logo.png new file mode 100644 index 0000000..f217c64 Binary files /dev/null and b/example-logo.png differ diff --git a/src/main/java/io/spring/api/ArticleApi.java b/src/main/java/io/spring/api/ArticleApi.java index 81ee7d9..724ea41 100644 --- a/src/main/java/io/spring/api/ArticleApi.java +++ b/src/main/java/io/spring/api/ArticleApi.java @@ -39,7 +39,7 @@ public class ArticleApi { @GetMapping public ResponseEntity article(@PathVariable("slug") String slug, - @AuthenticationPrincipal User user) { + @AuthenticationPrincipal User user) { return articleQueryService.findBySlug(slug, user) .map(articleData -> ResponseEntity.ok(articleResponse(articleData))) .orElseThrow(ResourceNotFoundException::new); @@ -47,8 +47,8 @@ public class ArticleApi { @PutMapping public ResponseEntity updateArticle(@PathVariable("slug") String slug, - @AuthenticationPrincipal User user, - @Valid @RequestBody UpdateArticleParam updateArticleParam) { + @AuthenticationPrincipal User user, + @Valid @RequestBody UpdateArticleParam updateArticleParam) { return articleRepository.findBySlug(slug).map(article -> { if (!AuthorizationService.canWriteArticle(user, article)) { throw new NoAuthorizationException();