Skip to content

burnettzhong/parliament

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parliament

Parliament is an API document center for microservice architecture based on SpringFox and Swagger. It aims to manage all APIs of individual microservices in one place.

The idea comes from GrokOla who provides a featured Wiki for dev teams. If you find Parliament is not enough for you, please take a look at GrokOla.

How to run Parliament server

Prerequisites

This project is implemented using Spring Boot, and MongoDB for database.

  • Java 1.8
  • Maven
  • MongoDB

Config Database

Modify MongoDB configurations in application.properties:

spring.data.mongodb.host = _MongoDB address_
spring.data.mongodb.database = _MongoDB database name_
spring.data.mongodb.port = _MongoDB port_

Build and Start up

Use following command to start:

mvn package && java -jar target/Parliament-1.0.0.jar

Publish API information

This section is only for Spring Boot application.

To publish API information to Parliament server, please use:

CAUTION: for khs-spring-boot-publish-swagger-starter, please do not use original one from Keyhole Software, since there are several bugs. I have created pull request to them, if they merge my code, I will update this section.

  1. Build and add khs-spring-boot-publish-swagger-starter dependency, run following command:

     git clone https://github.com/burnettzhong/khs-spring-boot-publish-swagger-starter
     cd khs-spring-boot-publish-swagger-starter
     mvn clean install
    
  2. Add maven dependencies

     <dependency>
         <groupId>io.springfox</groupId>
         <artifactId>springfox-swagger2</artifactId>
         <version>2.6.1</version>
     </dependency>
     <dependency>
         <groupId>com.keyholesoftware</groupId>
         <artifactId>khs-spring-boot-publish-swagger-starter</artifactId>
         <version>1.0.2</version>
     </dependency>
    
  3. Configure your Spring Boot application for Swagger and push API information to Parliament server. Simply add @EnableSwagger2 and @PublishSwagger annotations.

     @EnableSwagger2
     @PublishSwagger
     public class ServiceApplication {
         ...
     }
    

For more information about Swagger2 usage, please visit Springfox Reference Documentation.

  1. Add the following properties your application.yml file:

    swagger:
         publish:
             publish-url: http://{_Parliament server address_}/swagger/publish/
             swagger-url: http://127.0.0.1:${server.port}/v2/api-docs
    

That's all! Now you can start your Spring Boot application, the API information will be published to Parliament Server automatically.

Visit API information

Open http://{Parliament Server address}/index.html, you will see a list of all your microservices, then you can see more details if click on them.

License

Copyright 2017 Han Zhong - @burnettzhong

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0

About

API governance tool for Spring Boot application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages