Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

---

7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -48,3 +51,7 @@ dependencyManagement {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

bootJar {
launchScript()
}
58 changes: 58 additions & 0 deletions src/main/java/hive/kirby/swagger/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -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<String> 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/");
}
}