Skip to content

Commit b537acc

Browse files
committed
adding basic demo
1 parent 385a55f commit b537acc

File tree

3 files changed

+310
-0
lines changed

3 files changed

+310
-0
lines changed

demos/basic.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const gateway = require('./../index')
2+
const PORT = process.env.PORT || 8080
3+
4+
gateway({
5+
middlewares: [
6+
require('cors')(),
7+
require('helmet')()
8+
],
9+
10+
routes: [{
11+
prefix: '/public',
12+
target: 'http://public.myapp:300'
13+
}, {
14+
prefix: '/admin',
15+
target: 'http://admin.myapp:3000',
16+
middlewares: [
17+
require('express-jwt')({
18+
secret: 'shhhhhhared-secret'
19+
})
20+
]
21+
}]
22+
}).start(PORT).then(server => {
23+
console.log(`API Gateway listening on ${PORT} port!`)
24+
})

0 commit comments

Comments
 (0)