update readme

This commit is contained in:
aisensiy 2017-08-18 17:40:21 +08:00
parent b97bf72311
commit 5719b54e0d
3 changed files with 35 additions and 3 deletions

32
README.md Normal file
View File

@ -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.

BIN
example-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -39,7 +39,7 @@ public class ArticleApi {
@GetMapping @GetMapping
public ResponseEntity<?> article(@PathVariable("slug") String slug, public ResponseEntity<?> article(@PathVariable("slug") String slug,
@AuthenticationPrincipal User user) { @AuthenticationPrincipal User user) {
return articleQueryService.findBySlug(slug, user) return articleQueryService.findBySlug(slug, user)
.map(articleData -> ResponseEntity.ok(articleResponse(articleData))) .map(articleData -> ResponseEntity.ok(articleResponse(articleData)))
.orElseThrow(ResourceNotFoundException::new); .orElseThrow(ResourceNotFoundException::new);
@ -47,8 +47,8 @@ public class ArticleApi {
@PutMapping @PutMapping
public ResponseEntity<?> updateArticle(@PathVariable("slug") String slug, public ResponseEntity<?> updateArticle(@PathVariable("slug") String slug,
@AuthenticationPrincipal User user, @AuthenticationPrincipal User user,
@Valid @RequestBody UpdateArticleParam updateArticleParam) { @Valid @RequestBody UpdateArticleParam updateArticleParam) {
return articleRepository.findBySlug(slug).map(article -> { return articleRepository.findBySlug(slug).map(article -> {
if (!AuthorizationService.canWriteArticle(user, article)) { if (!AuthorizationService.canWriteArticle(user, article)) {
throw new NoAuthorizationException(); throw new NoAuthorizationException();