From 97d9338b7e12583820631b6ed8ae0a45faa70a7d Mon Sep 17 00:00:00 2001 From: Victor Hirumitsu <36802725+eiling@users.noreply.github.com> Date: Fri, 24 May 2019 19:31:08 -0300 Subject: [PATCH 1/3] Executable JAR --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 957437a..8fba8e3 100644 --- a/build.gradle +++ b/build.gradle @@ -48,3 +48,7 @@ dependencyManagement { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" } } + +bootJar { + launchScript() +} From 717ee9ea0974e56dfd014a784fb2dcad3eb95a51 Mon Sep 17 00:00:00 2001 From: germano Date: Sun, 22 Sep 2019 04:41:16 -0300 Subject: [PATCH 2/3] SpringFox Swagger Added :smile: --- build.gradle | 3 + .../hive/kirby/swagger/SwaggerConfig.java | 58 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/main/java/hive/kirby/swagger/SwaggerConfig.java diff --git a/build.gradle b/build.gradle index 8fba8e3..d2e4c66 100644 --- a/build.gradle +++ b/build.gradle @@ -40,6 +40,9 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' testImplementation 'org.springframework.boot:spring-boot-starter-test' + + compile 'io.springfox:springfox-swagger2:2.9.2' + compile 'io.springfox:springfox-swagger-ui:2.9.2' } dependencyManagement { diff --git a/src/main/java/hive/kirby/swagger/SwaggerConfig.java b/src/main/java/hive/kirby/swagger/SwaggerConfig.java new file mode 100644 index 0000000..0b3dbe1 --- /dev/null +++ b/src/main/java/hive/kirby/swagger/SwaggerConfig.java @@ -0,0 +1,58 @@ +package hive.kirby.swagger; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.HashSet; +import java.util.Set; + +@Configuration +@EnableSwagger2 +public class SwaggerConfig extends WebMvcConfigurationSupport { + + @Bean + public Docket apiDocumentation() { + Set responseContentTypes = new HashSet<>(); + responseContentTypes.add("*/*"); + responseContentTypes.add("text/plain"); + responseContentTypes.add("application/json"); + responseContentTypes.add("image/jpeg"); + return new + Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.basePackage("hive.kirby")) + .build() + .produces(responseContentTypes) + .consumes(responseContentTypes) + .apiInfo(metaData()); + } + + private ApiInfo metaData() { + return new + ApiInfoBuilder() + .title("Kirby endpoints") + .description("\"Profile image management API\"" + + "\n Repository: https://github.com/hex-g/kirby" + + "\n Created by: https://github.com/hex-g/") + .version("v1.0") + .license("") + .licenseUrl("") + .build(); + } + + @Override + protected void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("swagger-ui.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + } +} \ No newline at end of file From 1b61ffb71d6c9b7002c87365aaef751cc61bc92a Mon Sep 17 00:00:00 2001 From: germano Date: Sun, 22 Sep 2019 04:43:21 -0300 Subject: [PATCH 3/3] new ReadMe --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 3ab348c..f0d5ed2 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ # kirby +**The Hive's note-taking API** + +*"(੭。╹▿╹。)੭ Kirby will swallow and spit notes for you"* +### First steps +(Configuring the environment): + +1. git clone https://github.com/hex-g/kirby.git + 1. cd kirby +2. git checkout [branch] +3. git submodule init +4. git submodule update +5. Run the project in your IDE + 1. required JDK 11+ + 2. required Gradle compatible + +default swagger location: http://localhost:9400/swagger-ui.html + +--- +