Skip to content

Commit

Permalink
Keep swagger-combined simple 🐘
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhson1085 committed Nov 14, 2016
1 parent cc50637 commit baac9c9
Show file tree
Hide file tree
Showing 64 changed files with 37,892 additions and 464 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -24,4 +24,4 @@ RUN npm install
ADD . /build

# run app
CMD ["node", "routes/app.js"]
CMD ["node", "index.js"]
31 changes: 13 additions & 18 deletions README.md
@@ -1,5 +1,6 @@
[![Build Status](https://travis-ci.org/thanhson1085/swagger-combined.svg)](https://travis-ci.org/thanhson1085/swagger-combined)
[![Docker Pulls](https://img.shields.io/docker/pulls/thanhson1085/swagger-combined.svg)](https://hub.docker.com/r/thanhson1085/swagger-combined/)

[![NPM](https://nodei.co/npm/swagger-combined.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/swagger-combined/)

If you are building a microservice system and using Swagger.

Expand All @@ -9,28 +10,31 @@ For example, you have the swagger documents at `http://service1/docs`, `http://s

This will help you combine all links above to only one link `http://service/docs`

### Configuration
### Installation & Run from Docker
```
docker run -d -p 3000:3000 thanhson1085/swagger-combined
```

### Configuration file
See config/default.json as below:
```
{
"list_url": [
{
"docs": "http://petstore.swagger.io/v2/swagger.json",
"base_path": "http://petstore.swagger.io/v2",
"route_match": ["/user*", "/pet*"]
"route_filter": ["/store*"]
"route_match": ["/user*", "/pet*", "/store*"]
}
],
"info": { "title": "Example API", "version": "1.0" },
"port": 3000
}
```
- docs: swagger document links (can use `file://` format)
- docs: swagger document links
- base_path: Proxy Target
- route_match: Routes for proxy
- route_filter: prefixes to exclude

Change config/default.json to match your swagger links
Please make note that you changed `config/default.json` to match all swagger document links you have

### Installation & Run from Source Code
```
Expand All @@ -39,12 +43,11 @@ git clone https://github.com/thanhson1085/swagger-combined.git
Run:
```
cd swagger-combined
npm install
node routes/app.js
node index.js
```

### Test
In the default, swagger-combined run on port 3000 and included swagger-ui. So you just run `http://localhost:3000` to see everything you need. Or you can see swagger api at `http://localhost:3000/docs`
In the default, swagger-combined run on port 3000 and included swagger-ui. So you just run `http://localhost:3000?url=http://localhost:3000/docs` to see everything you need. Or you can see swagger api at `http://localhost:3000/docs`

### Example & Demo
With config/default.json:
Expand All @@ -65,15 +68,7 @@ With config/default.json:
"info": { "title": "Example API", "version": "1.0" },
"port": 3000
}
```
See [Demo](https://swagger-combined.sonnguyen.ws)

### Script
You can use the script at bin/swagger-combined.js to generate the same results as `/docs` to stdout
```
node bin/swagger-combined.js
```

### License (MIT)
Copyright (c) 2015 Nguyen Sy Thanh Son <thanhson1085@gmail.com>
26 changes: 0 additions & 26 deletions bin/swagger-combined.js

This file was deleted.

13 changes: 0 additions & 13 deletions code/bin/swagger-combined.js

This file was deleted.

65 changes: 0 additions & 65 deletions code/routes/app.js

This file was deleted.

76 changes: 0 additions & 76 deletions code/routes/swagger.js

This file was deleted.

9 changes: 1 addition & 8 deletions config/default.json
Expand Up @@ -3,14 +3,7 @@
{
"docs": "http://petstore.swagger.io/v2/swagger.json",
"base_path": "http://petstore.swagger.io/v2",
"route_match": ["/user*", "/pet*"],
"route_filter": ["/store*"]
},
{
"docs": "https://angular-admin-seed.sonnguyen.ws/docs",
"base_path": "https://angular-admin-seed.sonnguyen.ws",
"route_match": ["/api/v1*"],
"route_filter": []
"route_match": ["/user*", "/pet*", "/store*"]
}
],
"info": { "title": "Example API", "version": "1.0" },
Expand Down
34 changes: 0 additions & 34 deletions gulpfile.js

This file was deleted.

0 comments on commit baac9c9

Please sign in to comment.